diff options
Diffstat (limited to 'meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch')
-rw-r--r-- | meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch | 45 |
1 files changed, 45 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 0000000000..e68f53f4bc --- /dev/null +++ b/meta/recipes-devtools/python/python/python-2.7.3-CVE-2013-1752-httplib-fix.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | CVE-2013-1752: httplib: HTTPMessage.readheaders() raises an HTTPException | ||
4 | when more than 100 headers are read. | ||
5 | Patch by Jyrki Pulliainen and Daniel Eriksson. | ||
6 | |||
7 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> | ||
8 | --- | ||
9 | diff -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() | ||
29 | diff -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:' | ||