#29402: parse_header function in http/multipartparser.py unescapes in wrong 
order
------------------------------------------+------------------------
               Reporter:  Martin Dickopp  |          Owner:  nobody
                   Type:  Uncategorized   |         Status:  new
              Component:  Uncategorized   |        Version:  master
               Severity:  Normal          |       Keywords:
           Triage Stage:  Unreviewed      |      Has patch:  0
    Needs documentation:  0               |    Needs tests:  0
Patch needs improvement:  0               |  Easy pickings:  0
                  UI/UX:  0               |
------------------------------------------+------------------------
 Found by code review: It seems the parse_header function in
 http/multipartparser.py unescapes values in the wrong order:

 {{{
 value = value.replace(b'\\\\', b'\\').replace(b'\\"', b'"')
 }}}

 If {{{\\}}} is unescaped before {{{\"}}}, the sequence {{{\\"}}} will be
 unescaped to {{{\"}}} by the first replace function and unescaped again to
 {{{"}}} by the second replace function. This could be avoided by
 exchanging the replace functions:

 {{{
 value = value.replace(b'\\"', b'"').replace(b'\\\\', b'\\')
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29402>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.dda4300cddb97aef01b0dfd17ebf27e9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to