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 | |
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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/cgi/util.rb | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Fri Nov 13 00:46:24 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org> + + * lib/cgi/util.rb (CGI::pretty): fix the overflow bug + if stripped string.[ruby-dev:37975] + Thu Nov 12 23:08:11 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org> * lib/cgi/core.rb (read_from_cmdline): this code is better. 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 |