Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 908db6a

Browse files
Update zipslip_bad.py
1 parent 7f2d242 commit 908db6a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • python/ql/test/experimental/query-tests/Security/CWE-022

python/ql/test/experimental/query-tests/Security/CWE-022/zipslip_bad.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import shutil
33

44
def unzip(filename):
5-
zf = zipfile.ZipFile()
6-
with zf.open(filename) as zipf:
5+
6+
with zipfile.ZipFile(filename) as zipf:
77
#BAD : This could write any file on the filesystem.
8-
for entry in zipf:
9-
shutil.copyfileobj(entry, "/tmp/unpack/")
8+
for entry in zipf:
9+
shutil.copy(entry, "/tmp/unpack/")

0 commit comments

Comments
 (0)