Skip to content

Commit a4a481c

Browse files
committed
do not follow symlinks
1 parent d97e83e commit a4a481c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/tarfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ def extractall(self, path=".", members=None, *, numeric_owner=False,
23992399
# if it was changed during extraction.
24002400
dirpath = os.path.join(path, tarinfo.name)
24012401
dirpath = self._transform_destination_path(dirpath)
2402-
targetstat = os.stat(dirpath)
2402+
targetstat = os.stat(dirpath, follow_symlinks=False)
24032403
directories.append((tarinfo, dirpath, targetstat.st_ino,
24042404
targetstat.st_dev))
24052405

@@ -2408,7 +2408,7 @@ def extractall(self, path=".", members=None, *, numeric_owner=False,
24082408

24092409
# Set correct owner, mtime and filemode on directories.
24102410
for tarinfo, dirpath, original_ino, original_dev in directories:
2411-
dirstat = os.stat(dirpath)
2411+
dirstat = os.stat(dirpath, follow_symlinks=False)
24122412
if (dirstat.st_ino != original_ino or
24132413
dirstat.st_dev != original_dev):
24142414
self._dbg(1, "tarfile: Directory renamed before its " \

0 commit comments

Comments
 (0)