Skip to content

Commit 89bef11

Browse files
committed
fixes #205
1 parent c3e8780 commit 89bef11

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

quazip/zip.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
11021102
return ZIP_PARAMERROR;
11031103
#endif
11041104

1105+
// The filename and comment length must fit in 16 bits.
1106+
if ((filename!=NULL) && (strlen(filename)>0xffff))
1107+
return ZIP_PARAMERROR;
1108+
if ((comment!=NULL) && (strlen(comment)>0xffff))
1109+
return ZIP_PARAMERROR;
1110+
// The extra field length must fit in 16 bits. If the member also requires
1111+
// a Zip64 extra block, that will also need to fit within that 16-bit
1112+
// length, but that will be checked for later.
1113+
if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
1114+
return ZIP_PARAMERROR;
1115+
11051116
zi = (zip64_internal*)file;
11061117

11071118
if (zi->in_opened_file_inzip == 1)

0 commit comments

Comments
 (0)