summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-09-21 23:37:21 (GMT)
committerTudor Florea <tudor.florea@enea.com>2015-10-22 03:43:33 (GMT)
commitff46766bf74cb96e103715de232c3cf09a69616e (patch)
tree02e5c533844ca0872bf8a7408ee0a1c4fcf6532c
parent972dcfcdbfe75dcfeb777150c136576cf1a71e99 (diff)
downloadpoky-ff46766bf74cb96e103715de232c3cf09a69616e.tar.gz
python: Backport CVE-2013-1752 fix from upstream
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch45
-rw-r--r--meta/recipes-devtools/python/python_2.7.3.bb1
2 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch
new file mode 100644
index 0000000..e68f53f
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch
@@ -0,0 +1,45 @@
1Upstream-Status: Backport
2
3CVE-2013-1752: httplib: HTTPMessage.readheaders() raises an HTTPException
4when more than 100 headers are read.
5Patch by Jyrki Pulliainen and Daniel Eriksson.
6
7Signed-off-by: Tudor Florea <tudor.florea@enea.com>
8---
9diff -r 133ee2b48e52 Lib/httplib.py
10--- a/Lib/httplib.py Fri Aug 01 23:51:51 2014 -0700
11+++ b/Lib/httplib.py Sat Aug 02 13:59:25 2014 +0000
12@@ -214,6 +214,7 @@
13
14 # maximal line length when calling readline().
15 _MAXLINE = 65536
16+_MAXHEADERS = 100
17
18 class HTTPMessage(mimetools.Message):
19
20@@ -271,6 +272,8 @@
21 elif self.seekable:
22 tell = self.fp.tell
23 while True:
24+ if len(hlist) > _MAXHEADERS:
25+ raise HTTPException("got more than %d headers" % _MAXHEADERS)
26 if tell:
27 try:
28 startofline = tell()
29diff -r 133ee2b48e52 Lib/test/test_httplib.py
30--- a/Lib/test/test_httplib.py Fri Aug 01 23:51:51 2014 -0700
31+++ b/Lib/test/test_httplib.py Sat Aug 02 13:59:25 2014 +0000
32@@ -262,6 +262,13 @@
33 if resp.read() != "":
34 self.fail("Did not expect response from HEAD request")
35
36+ def test_too_many_headers(self):
37+ headers = '\r\n'.join('Header%d: foo' % i for i in xrange(200)) + '\r\n'
38+ text = ('HTTP/1.1 200 OK\r\n' + headers)
39+ s = FakeSocket(text)
40+ r = httplib.HTTPResponse(s)
41+ self.assertRaises(httplib.HTTPException, r.begin)
42+
43 def test_send_file(self):
44 expected = 'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \
45 'Accept-Encoding: identity\r\nContent-Length:'
diff --git a/meta/recipes-devtools/python/python_2.7.3.bb b/meta/recipes-devtools/python/python_2.7.3.bb
index de1f57f..5e0181d 100644
--- a/meta/recipes-devtools/python/python_2.7.3.bb
+++ b/meta/recipes-devtools/python/python_2.7.3.bb
@@ -42,6 +42,7 @@ SRC_URI += "\
42 file://python2.7.3-nossl3.patch \ 42 file://python2.7.3-nossl3.patch \
43 file://ctypes-libffi-aarch64.patch \ 43 file://ctypes-libffi-aarch64.patch \
44 file://libffi-aarch64.patch \ 44 file://libffi-aarch64.patch \
45 file://python-2.7.3-CVE-2013-1752-httplib-fix.patch \
45" 46"
46 47
47S = "${WORKDIR}/Python-${PV}" 48S = "${WORKDIR}/Python-${PV}"