Skip to content

Commit fd5ba13

Browse files
ambvAA-Turner
andauthored
Fix invalid parent directory unwinding in test
Co-authored-by: Adam Turner <[email protected]>
1 parent b59eaaa commit fd5ba13

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/test_tarfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3813,7 +3813,8 @@ def test_realpath_limit_attack(self):
38133813
# this link will never be expanded by
38143814
# os.path.realpath(strict=False), nor anything after it.
38153815
linkpath = os.path.join(*steps, "l"*254)
3816-
arc.add(linkpath, symlink_to=os.path.join(*".." * len(steps)))
3816+
parent_segments = [".."] * len(steps)
3817+
arc.add(linkpath, symlink_to=os.path.join(*parent_segments))
38173818
# make a symlink outside to keep the tar command happy
38183819
arc.add("escape", symlink_to=os.path.join(linkpath, ".."))
38193820
# use the symlinks above, that are not checked, to create a hardlink

0 commit comments

Comments
 (0)