From: Paul Rogers <pmr16366@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Re: bug report and unit test for infinite loop parsing Content-Disposion header
Date: Mon, 7 May 2012 08:04:28 -0700 (PDT) [thread overview]
Message-ID: <d2ddf45d-a232-4def-8633-88a4bf5c0f5e@l5g2000pbo.googlegroups.com> (raw)
In-Reply-To: <DDB223C8-A00C-4EB5-9121-D370EA9264AF@gmail.com>
Thanks for the responses, and sorry for the double posting, not sure
what happened there.
I also found I can quote the filename which passes the tests. The app
Im using this in is a mock for another service, and I'll have to check
if the real service accepts a quoted string.
I'll also try these fixes in case that works better for me
Thanks
Paul
On May 6, 6:39 pm, Lawrence Pit <lawrence....@gmail.com> wrote:
> Given the value of DISPPARM must always have at least 1 character (according to RFC2183 and RFC2045) that fix seems correct to me.
>
> In addition I would make the TOKEN regexp non-greedy (for the BROKEN_UNQUOTED case):
>
> TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+?/
>
> Also, why is the "@" character accepted as part of a TOKEN? It is part of the tspecials (in RFC2045), so I think it should not be accepted as a valid token character.
>
> Cheers,
> Lawrence
>
>
>
>
>
>
>
> > I think the following should fix your issue (but I'm not sure it's
> > correct):
>
> > diff --git a/lib/rack/multipart.rb b/lib/rack/multipart.rb
> > index 3777106..6849248 100644
> > --- a/lib/rack/multipart.rb
> > +++ b/lib/rack/multipart.rb
> > @@ -12,7 +12,7 @@ module Rack
> > MULTIPART = %r|\Amultipart/.*boundary=\"?([^\";,]+)\"?|n
> > TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+/
> > CONDISP = /Content-Disposition:\s*#{TOKEN}\s*/i
> > - DISPPARM = /;\s*(#{TOKEN})=("(?:\\"|[^"])*"|#{TOKEN})*/
> > + DISPPARM = /;\s*(#{TOKEN})=("(?:\\"|[^"])*"|#{TOKEN})/
> > RFC2183 = /^#{CONDISP}(#{DISPPARM})+$/i
> > BROKEN_QUOTED = /^#{CONDISP}.*;\sfilename="(.*?)"(?:\s*$|\s*;\s*#{TOKEN}=)/i
> > BROKEN_UNQUOTED = /^#{CONDISP}.*;\sfilename=(#{TOKEN})/i
next prev parent reply other threads:[~2012-05-07 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-04 21:37 bug report and unit test for infinite loop parsing Content-Disposion header Paul Rogers
2012-05-04 23:34 ` Eric Wong
2012-05-07 0:39 ` Lawrence Pit
2012-05-07 15:04 ` Paul Rogers [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-05-04 21:37 Paul Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://groups.google.com/group/rack-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d2ddf45d-a232-4def-8633-88a4bf5c0f5e@l5g2000pbo.googlegroups.com \
--to=rack-devel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).