mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
simplify code
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
c10c6bf894
commit
8947cbf4d1
|
@ -480,8 +480,8 @@ def extract_dep(url, filename):
|
||||||
zf.extractall(sources_dir)
|
zf.extractall(sources_dir)
|
||||||
elif filename.endswith(".tar.gz") or filename.endswith(".tgz"):
|
elif filename.endswith(".tar.gz") or filename.endswith(".tgz"):
|
||||||
with tarfile.open(file, "r:gz") as tgz:
|
with tarfile.open(file, "r:gz") as tgz:
|
||||||
for member in tgz.getmembers():
|
for member in tgz.getnames():
|
||||||
member_abspath = os.path.abspath(os.path.join(sources_dir, member.name))
|
member_abspath = os.path.abspath(os.path.join(sources_dir, member))
|
||||||
member_prefix = os.path.commonpath([sources_dir_abs, member_abspath])
|
member_prefix = os.path.commonpath([sources_dir_abs, member_abspath])
|
||||||
if sources_dir_abs != member_prefix:
|
if sources_dir_abs != member_prefix:
|
||||||
raise RuntimeError("Attempted Path Traversal in Tar File")
|
raise RuntimeError("Attempted Path Traversal in Tar File")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user