• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff -Npur zlib-v1.2.11/contrib/minizip/zip.c zlib-v1.2.11-change/contrib/minizip/zip.c
2--- zlib-v1.2.11/contrib/minizip/zip.c	2017-01-16 01:29:40.000000000 +0800
3+++ zlib-v1.2.11-change/contrib/minizip/zip.c	2023-10-16 15:13:00.436760625 +0800
4@@ -1083,6 +1083,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_
5       return ZIP_PARAMERROR;
6 #endif
7
8+    // The filename and comment length must fit in 16 bits.
9+    if ((filename!=NULL) && (strlen(filename)>0xffff))
10+        return ZIP_PARAMERROR;
11+    if ((comment!=NULL) && (strlen(comment)>0xffff))
12+        return ZIP_PARAMERROR;
13+    // The extra field length must fit in 16 bits. If the member also requires
14+    // a Zip64 extra block, that will also need to fit within that 16-bit
15+    // length, but that will be checked for later.
16+    if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
17+        return ZIP_PARAMERROR;
18+
19     zi = (zip64_internal*)file;
20
21     if (zi->in_opened_file_inzip == 1)
22