File CVE-2021-3737-fix-HTTP-client-infinite-line-reading-after-a-HTTP-100-Continue.patch of Package python (Revision 7c7532457b948cc36e86ff51d95885bc)
Currently displaying revision 7c7532457b948cc36e86ff51d95885bc , Show latest
27
1
--- a/Lib/httplib.py
2
+++ b/Lib/httplib.py
3
4
if status != CONTINUE:
5
break
6
# skip the header from the 100 response
7
+ header_count = 0
8
while True:
9
skip = self.fp.readline(_MAXLINE + 1)
10
if len(skip) > _MAXLINE:
11
12
break
13
if self.debuglevel > 0:
14
print "header:", skip
15
+ # CVE-2021-3737: Fix infinitely reading potential HTTP headers on a 100 Continue status response from the server
16
+ header_count += 1
17
+ if header_count > _MAXHEADERS:
18
+ raise HTTPException("got more than %d headers" % _MAXHEADERS)
19
20
self.status = status
21
self.reason = reason.strip()
22
--- /dev/null
23
+++ b/Misc/NEWS.d/next/Security/2021-05-05-17-37-04.bpo-44022.bS3XJ9.rst
24
25
+mod:`http.client` now avoids infinitely reading potential HTTP headers after a
26
+``100 Continue`` status response from the server.
27