Skip to content

Commit 6b279c3

Browse files
committed
* lib/cgi.rb (CGI::QueryExtension::read_multipart): should quote
boundary. JVN#84798830 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 5ce3877 commit 6b279c3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Mon Dec 4 08:32:25 2006 Shugo Maeda <shugo@ruby-lang.org>
2+
3+
* lib/cgi.rb (CGI::QueryExtension::read_multipart): should quote
4+
boundary. JVN#84798830
5+
16
Sun Dec 3 16:16:53 2006 Akinori MUSHA <knu@iDaemons.org>
27

38
* ext/digest/lib/digest/hmac.rb: Fix problems with update

lib/cgi.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ def params=(hash)
977977
def read_multipart(boundary, content_length)
978978
params = Hash.new([])
979979
boundary = "--" + boundary
980+
quoted_boundary = Regexp.quote(boundary, "n")
980981
buf = ""
981982
bufsize = 10 * 1024
982983
boundary_end=""
@@ -996,7 +997,7 @@ def read_multipart(boundary, content_length)
996997
head = nil
997998
body = MorphingBody.new
998999

999-
until head and /#{boundary}(?:#{EOL}|--)/n.match(buf)
1000+
until head and /#{quoted_boundary}(?:#{EOL}|--)/n.match(buf)
10001001
if (not head) and /#{EOL}#{EOL}/n.match(buf)
10011002
buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do
10021003
head = $1.dup
@@ -1022,7 +1023,7 @@ def read_multipart(boundary, content_length)
10221023
content_length -= c.size
10231024
end
10241025

1025-
buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{boundary}([\r\n]{1,2}|--)/n) do
1026+
buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{quoted_boundary}([\r\n]{1,2}|--)/n) do
10261027
body.print $1
10271028
if "--" == $2
10281029
content_length = -1

0 commit comments

Comments
 (0)