diff options
author | xibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-12 15:48:46 +0000 |
---|---|---|
committer | xibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-12 15:48:46 +0000 |
commit | 5de99652bd368ea2876357b626428f66dd193e14 (patch) | |
tree | 4c038773ade30d694a4b01d2747d38536422272b /lib/cgi/util.rb | |
parent | f97d8eec10ff0843522dc37467e209b6f27c7c6b (diff) | |
download | ruby-5de99652bd368ea2876357b626428f66dd193e14.tar.gz |
* lib/cgi/util.rb (CGI::pretty): fix the overflow bug
if stripped string.[ruby-dev:37975]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi/util.rb')
-rw-r--r-- | lib/cgi/util.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb index fbba00b963..42f1336e9f 100644 --- a/lib/cgi/util.rb +++ b/lib/cgi/util.rb @@ -170,7 +170,7 @@ class CGI # # </HTML> # def CGI::pretty(string, shift = " ") - lines = string.gsub(/(?!\A)<(?:.|\n)*?>/, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/, "\\0\n") + lines = string.gsub(/(?!\A)<.*?>/m, "\n\\0").gsub(/<.*?>(?!\n)/m, "\\0\n") end_pos = 0 while end_pos = lines.index(/^<\/(\w+)/, end_pos) element = $1.dup |