summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2015-07-02 17:38:38 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2015-07-02 17:38:38 (GMT)
commitb7a688b3a40705ab4f7f7035d40ec026899c7052 (patch)
treec61e60f49ff4a846603bbe805b1fb73c70d9be13 /Lib/tarfile.py
parent3ef80587f01af27427fc1fcc05d8fd1726edd23d (diff)
downloadcpython-b7a688b3a40705ab4f7f7035d40ec026899c7052.zip
cpython-b7a688b3a40705ab4f7f7035d40ec026899c7052.tar.gz
cpython-b7a688b3a40705ab4f7f7035d40ec026899c7052.tar.bz2
Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index e3a2bb3..6d8d36c 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -178,7 +178,8 @@ def nti(s):
n = -(256 ** (len(s) - 1) - n)
else:
try:
- n = int(nts(s, "ascii", "strict") or "0", 8)
+ s = nts(s, "ascii", "strict")
+ n = int(s.strip() or "0", 8)
except ValueError:
raise InvalidHeaderError("invalid header")
return n