Skip to content

Commit 6d211dd

Browse files
committedJun 30, 2022
minor cleanup
1 parent 7490d86 commit 6d211dd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎unzip_http.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ def infolist(self):
7171
sz = int(resp.headers['Content-Length'])
7272
resp = self.get_range(sz-65536, 65536)
7373

74-
eocdloc = eocd = eocd64 = None
75-
76-
cdir_start = 0
74+
cdir_start = -1
7775
i = resp.data.rfind(b'\x50\x4b\x06\x06')
7876
if i >= 0:
7977
magic, eocd_sz, create_ver, min_ver, disk_num, disk_start, disk_num_records, total_num_records, \
@@ -85,7 +83,7 @@ def infolist(self):
8583
disk_num, disk_start, disk_num_records, total_num_records, \
8684
cdir_bytes, cdir_start, comment_len = struct.unpack_from(self.fmt_eocd, resp.data, offset=i)
8785

88-
if cdir_start <= 0 or cdir_start > sz:
86+
if cdir_start < 0 or cdir_start >= sz:
8987
error('cannot find central directory')
9088

9189
filehdr_index = 65536 - (sz - cdir_start)

0 commit comments

Comments
 (0)
Please sign in to comment.