File tree Expand file tree Collapse file tree 1 file changed +1
-11
lines changed
Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change @@ -3536,25 +3536,15 @@ def tearDown(self):
35363536 @unittest .skipUnless (sys .platform == 'win32' , 'Windows-specific traversal test' )
35373537 @support .requires_zlib ()
35383538 def test_unpack_zipfile_traversal_windows_drive (self ):
3539- # Create a ZIP file with a drive- prefixed path
3539+ # Create a ZIP file with a drive prefixed path
35403540 zip_path = os .path .join (self .tmp_dir , "test.zip" )
35413541 with zipfile .ZipFile (zip_path , 'w' ) as zf :
3542- # zipfile.extractall() should sanitize this to 'D/traversal.txt'
3543- # relative to extract_dir.
35443542 zf .writestr ("D:/traversal.txt" , "found you" )
3545-
3546- # Prior to the fix, this might have attempted to write to D:/traversal.txt
3547- # With the fix (using extractall()), it's safely joined.
35483543 shutil .unpack_archive (zip_path , self .extract_dir )
3549-
3550- # Check that it didn't go to D:/
35513544 self .assertFalse (os .path .exists ("D:/traversal.txt" ))
3552-
3553- # Check where it actually went
35543545 found = False
35553546 for root , dirs , files in os .walk (self .extract_dir ):
35563547 if "traversal.txt" in files :
35573548 found = True
35583549 break
35593550 self .assertTrue (found , "Extracted file not found within extract_dir" )
3560-
You can’t perform that action at this time.
0 commit comments