aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-01 09:56:04 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-01 09:56:04 -0800
commit139963c99a955520db6373343662e55f4d16dcd1 (patch)
tree56220dd9b09dc2341c6431784aa0f13d96d72743 /actionpack/lib/action_view/helpers
parentceb66b61264657898cd6608c7e9ed78072169664 (diff)
parent8ccaa34103f1c37f7549f7f6c47a21dba21624db (diff)
downloadrails-139963c99a955520db6373343662e55f4d16dcd1.tar.gz
rails-139963c99a955520db6373343662e55f4d16dcd1.tar.bz2
rails-139963c99a955520db6373343662e55f4d16dcd1.zip
Merge branch 'master-security'
* master-security: Ensure [] respects the status of the buffer. delete vulnerable AS::SafeBuffer#[] use AS::SafeBuffer#clone_empty for flushing the output_buffer add AS::SafeBuffer#clone_empty fix output safety issue with select options Conflicts: actionpack/lib/action_view/helpers/tags/base.rb
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/capture_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/tags/base.rb5
2 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb
index 17bbfe2efd..278139cadb 100644
--- a/actionpack/lib/action_view/helpers/capture_helper.rb
+++ b/actionpack/lib/action_view/helpers/capture_helper.rb
@@ -215,7 +215,7 @@ module ActionView
def flush_output_buffer #:nodoc:
if output_buffer && !output_buffer.empty?
response.body_parts << output_buffer
- self.output_buffer = output_buffer[0,0]
+ self.output_buffer = output_buffer.respond_to?(:clone_empty) ? output_buffer.clone_empty : output_buffer[0, 0]
nil
end
end
diff --git a/actionpack/lib/action_view/helpers/tags/base.rb b/actionpack/lib/action_view/helpers/tags/base.rb
index c9c891daa1..22c16de057 100644
--- a/actionpack/lib/action_view/helpers/tags/base.rb
+++ b/actionpack/lib/action_view/helpers/tags/base.rb
@@ -133,12 +133,11 @@ module ActionView
def add_options(option_tags, options, value = nil)
if options[:include_blank]
- include_blank = options[:include_blank] if options[:include_blank].kind_of?(String)
- option_tags = content_tag(:option, include_blank, :value => '').safe_concat("\n").safe_concat(option_tags)
+ option_tags = content_tag('option', options[:include_blank].kind_of?(String) ? options[:include_blank] : nil, :value => '') + "\n" + option_tags
end
if value.blank? && options[:prompt]
prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('helpers.select.prompt', :default => 'Please select')
- option_tags = content_tag(:option, prompt, :value => '').safe_concat("\n").safe_concat(option_tags)
+ option_tags = content_tag('option', prompt, :value => '') + "\n" + option_tags
end
option_tags
end