mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +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)
|
||||
elif filename.endswith(".tar.gz") or filename.endswith(".tgz"):
|
||||
with tarfile.open(file, "r:gz") as tgz:
|
||||
for member in tgz.getmembers():
|
||||
member_abspath = os.path.abspath(os.path.join(sources_dir, member.name))
|
||||
for member in tgz.getnames():
|
||||
member_abspath = os.path.abspath(os.path.join(sources_dir, member))
|
||||
member_prefix = os.path.commonpath([sources_dir_abs, member_abspath])
|
||||
if sources_dir_abs != member_prefix:
|
||||
raise RuntimeError("Attempted Path Traversal in Tar File")
|
||||
|
|
Loading…
Reference in New Issue
Block a user