diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-09-09 09:49:33 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-09-09 09:49:33 -0700 |
commit | d5893a517ff1dd75bb1ec4c0e7774c9312e5c9c4 (patch) | |
tree | 230d8c47808d3c27e6257e3341a3c007e3ea6d00 /activesupport/lib/active_support | |
parent | dc0411fad78bfc92fe92dc88bbad726eb4d1a883 (diff) | |
parent | 6e2851d4261fbbea00e8e74802a507a89af80e2f (diff) | |
download | rails-d5893a517ff1dd75bb1ec4c0e7774c9312e5c9c4.tar.gz rails-d5893a517ff1dd75bb1ec4c0e7774c9312e5c9c4.tar.bz2 rails-d5893a517ff1dd75bb1ec4c0e7774c9312e5c9c4.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/rexml.rb | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/activesupport/lib/active_support/core_ext/rexml.rb b/activesupport/lib/active_support/core_ext/rexml.rb index af8ce3af47..058295b057 100644 --- a/activesupport/lib/active_support/core_ext/rexml.rb +++ b/activesupport/lib/active_support/core_ext/rexml.rb @@ -5,30 +5,28 @@ require 'rexml/entity' # http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/ # This fix is identical to rexml-expansion-fix version 1.0.1 -unless REXML::VERSION > "3.1.7.2" - module REXML - class Entity < Child - undef_method :unnormalized - def unnormalized - document.record_entity_expansion! if document - v = value() - return nil if v.nil? - @unnormalized = Text::unnormalize(v, parent) - @unnormalized - end +module REXML + class Entity < Child + undef_method :unnormalized + def unnormalized + document.record_entity_expansion! if document + v = value() + return nil if v.nil? + @unnormalized = Text::unnormalize(v, parent) + @unnormalized + end + end + class Document < Element + @@entity_expansion_limit = 10_000 + def self.entity_expansion_limit= val + @@entity_expansion_limit = val end - class Document < Element - @@entity_expansion_limit = 10_000 - def self.entity_expansion_limit= val - @@entity_expansion_limit = val - end - def record_entity_expansion! - @number_of_expansions ||= 0 - @number_of_expansions += 1 - if @number_of_expansions > @@entity_expansion_limit - raise "Number of entity expansions exceeded, processing aborted." - end + def record_entity_expansion! + @number_of_expansions ||= 0 + @number_of_expansions += 1 + if @number_of_expansions > @@entity_expansion_limit + raise "Number of entity expansions exceeded, processing aborted." end end end |