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

Skip to content

Commit b5f1e9d

Browse files
Update zipslip_bad.py
1 parent a05318f commit b5f1e9d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

python/ql/src/experimental/Security/CWE-022/zipslip_bad.py

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

44
def unzip(filename):
5-
with zipfile.ZipFile(filename) as zipf:
5+
with zipfile.ZipFile(filename) as zipf:
66
#BAD : This could write any file on the filesystem.
7-
for entry in zipf:
8-
shutil.copy(entry, "/tmp/unpack/")
7+
for entry in zipf:
8+
shutil.copy(entry, "/tmp/unpack/")
99

1010
def unzip1(filename):
11-
with zipfile.ZipFile(filename) as zipf:
12-
for entry in zipf:
13-
with open(entry, 'wb') as dstfile:
14-
shutil.copyfileobj(zipf, dstfile)
11+
with zipfile.ZipFile(filename) as zipf:
12+
for entry in zipf:
13+
with open(entry, 'wb') as dstfile:
14+
shutil.copyfileobj(zipf, dstfile)

0 commit comments

Comments
 (0)