summaryrefslogtreecommitdiff
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 999a99b978..8015fae7a6 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -1221,6 +1221,8 @@ class TarInfo(object):
length, keyword = match.groups()
length = int(length)
+ if length == 0:
+ raise InvalidHeaderError("invalid header")
value = buf[match.end(2) + 1:match.start(1) + length - 1]
# Normally, we could just use "utf-8" as the encoding and "strict"