Skip to content

Commit 4b483dd

Browse files
committed
update to python 2.7.18
1 parent d6acc5c commit 4b483dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3487
-21
lines changed

PythonLib/extra_dll/_bsddb.pyd

0 Bytes
Binary file not shown.

PythonLib/extra_dll_x64/_bsddb.pyd

0 Bytes
Binary file not shown.

PythonLib/full/cookielib.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,14 @@ def _str2time(day, mon, yr, hr, min, sec, tz):
205205
(?::(\d\d))? # optional seconds
206206
)? # optional clock
207207
\s*
208-
([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+)? # timezone
208+
(?:
209+
([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone
210+
\s*
211+
)?
212+
(?:
213+
\(\w+\) # ASCII representation of timezone in parens.
209214
\s*
210-
(?:\(\w+\))? # ASCII representation of timezone in parens.
211-
\s*$""", re.X)
215+
)?$""", re.X)
212216
def http2time(text):
213217
"""Returns time in seconds since epoch of time represented by a string.
214218
@@ -266,7 +270,7 @@ def http2time(text):
266270
return _str2time(day, mon, yr, hr, min, sec, tz)
267271

268272
ISO_DATE_RE = re.compile(
269-
"""^
273+
r"""^
270274
(\d{4}) # year
271275
[-\/]?
272276
(\d\d?) # numerical month
@@ -278,9 +282,11 @@ def http2time(text):
278282
(?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional)
279283
)? # optional clock
280284
\s*
281-
([-+]?\d\d?:?(:?\d\d)?
282-
|Z|z)? # timezone (Z is "zero meridian", i.e. GMT)
283-
\s*$""", re.X)
285+
(?:
286+
([-+]?\d\d?:?(:?\d\d)?
287+
|Z|z) # timezone (Z is "zero meridian", i.e. GMT)
288+
\s*
289+
)?$""", re.X)
284290
def iso2time(text):
285291
"""
286292
As for http2time, but parses the ISO 8601 formats:

PythonLib/full/encodings/uu_codec.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def uu_encode(input,errors='strict',filename='<data>',mode=0666):
3131
read = infile.read
3232
write = outfile.write
3333

34+
# Remove newline chars from filename
35+
filename = filename.replace('\n','\\n')
36+
filename = filename.replace('\r','\\r')
37+
3438
# Encode
3539
write('begin %o %s\n' % (mode & 0777, filename))
3640
chunk = read(45)

PythonLib/full/httplib.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ def __init__(self, host, port=None, strict=None,
745745

746746
(self.host, self.port) = self._get_hostport(host, port)
747747

748+
self._validate_host(self.host)
749+
748750
# This is stored as an instance variable to allow unittests
749751
# to replace with a suitable mock
750752
self._create_connection = socket.create_connection
@@ -1029,6 +1031,17 @@ def _validate_path(self, url):
10291031
).format(matched=match.group(), url=url)
10301032
raise InvalidURL(msg)
10311033

1034+
def _validate_host(self, host):
1035+
"""Validate a host so it doesn't contain control characters."""
1036+
# Prevent CVE-2019-18348.
1037+
match = _contains_disallowed_url_pchar_re.search(host)
1038+
if match:
1039+
msg = (
1040+
"URL can't contain control characters. {host!r} "
1041+
"(found at least {matched!r})"
1042+
).format(matched=match.group(), host=host)
1043+
raise InvalidURL(msg)
1044+
10321045
def putheader(self, header, *values):
10331046
"""Send a request header line to the server.
10341047

PythonLib/full/urllib.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,13 @@ def retrfile(self, file, type):
934934
return (ftpobj, retrlen)
935935

936936
def endtransfer(self):
937+
if not self.busy:
938+
return
937939
self.busy = 0
940+
try:
941+
self.ftp.voidresp()
942+
except ftperrors():
943+
pass
938944

939945
def close(self):
940946
self.keepalive = False

PythonLib/full/uu.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None):
7373
name = '-'
7474
if mode is None:
7575
mode = 0666
76+
77+
#
78+
# Remove newline chars from name
79+
#
80+
name = name.replace('\n','\\n')
81+
name = name.replace('\r','\\r')
82+
7683
#
7784
# Write the data
7885
#

PythonLib/full_dll/_ctypes.pyd

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

PythonLib/full_dll/_hashlib.pyd

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)