summaryrefslogtreecommitdiff
path: root/django/http/multipartparser.py
diff options
context:
space:
mode:
authorRaul Cumplido <raulcumplido@gmail.com>2015-01-24 12:14:30 +0000
committerClaude Paroz <claude@2xlibre.net>2015-01-27 20:12:22 +0100
commitac650d02cbb66ab652ae529b8f03b486ef974dfb (patch)
tree652d2c933dae539bbe1261d4451900832c64b3fa /django/http/multipartparser.py
parent332139d23dc79cdc846e8e51f0eeee7ddbc9d568 (diff)
Fixed #24209 -- Prevented crash when parsing malformed RFC 2231 headers
Thanks Tom Christie for the report and review.
Diffstat (limited to 'django/http/multipartparser.py')
-rw-r--r--django/http/multipartparser.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 07c874e08f..e1de03f8b1 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -643,7 +643,8 @@ def parse_header(line):
# Lang/encoding embedded in the value (like "filename*=UTF-8''file.ext")
# http://tools.ietf.org/html/rfc2231#section-4
name = name[:-1]
- has_encoding = True
+ if p.count(b"'") == 2:
+ has_encoding = True
value = p[i + 1:].strip()
if has_encoding:
encoding, lang, value = value.split(b"'")