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

Skip to content

Commit e8449d8

Browse files
Update zipslip_bad.py
1 parent b7d4715 commit e8449d8

1 file changed

Lines changed: 8 additions & 0 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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ def unzip(filename):
77
#BAD : This could write any file on the filesystem.
88
for entry in zipf:
99
shutil.copy(entry, "/tmp/unpack/")
10+
11+
def unzip1(filename):
12+
13+
14+
with zipfile.ZipFile(filename) as zipf:
15+
for entry in zipf:
16+
with open(entry, 'wb') as dstfile:
17+
shutil.copyfileobj(zipf, dstfile)

0 commit comments

Comments
 (0)