diff options
author | Mark Adler <fork@madler.net> | 2022-10-06 15:49:04 -0700 |
---|---|---|
committer | Mark Adler <fork@madler.net> | 2022-10-06 20:43:18 -0700 |
commit | 138c93cffb76f5c24e4ae6e81e6210428856f825 (patch) | |
tree | 04ed18dcd05ee70c840c12769a75049e8a729267 | |
parent | 9b291c9f013f99ad494ffecf4295cb2f594a18e3 (diff) | |
download | zlib-138c93cffb76f5c24e4ae6e81e6210428856f825.tar.gz zlib-138c93cffb76f5c24e4ae6e81e6210428856f825.tar.bz2 zlib-138c93cffb76f5c24e4ae6e81e6210428856f825.zip |
Security and warning fixes for minizip. [gvollant]
Remove unused code and unnecessary test for free().
-rw-r--r-- | contrib/minizip/unzip.c | 4 | ||||
-rw-r--r-- | contrib/minizip/zip.c | 7 |
2 files changed, 4 insertions, 7 deletions
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 5e12e47..3036b47 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -112,7 +112,7 @@ | |||
112 | # define ALLOC(size) (malloc(size)) | 112 | # define ALLOC(size) (malloc(size)) |
113 | #endif | 113 | #endif |
114 | #ifndef TRYFREE | 114 | #ifndef TRYFREE |
115 | # define TRYFREE(p) {if (p) free(p);} | 115 | # define TRYFREE(p) { free(p);} |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | #define SIZECENTRALDIRITEM (0x2e) | 118 | #define SIZECENTRALDIRITEM (0x2e) |
@@ -1566,6 +1566,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, | |||
1566 | pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; | 1566 | pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; |
1567 | else | 1567 | else |
1568 | { | 1568 | { |
1569 | TRYFREE(pfile_in_zip_read_info->read_buffer); | ||
1569 | TRYFREE(pfile_in_zip_read_info); | 1570 | TRYFREE(pfile_in_zip_read_info); |
1570 | return err; | 1571 | return err; |
1571 | } | 1572 | } |
@@ -1586,6 +1587,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, | |||
1586 | pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; | 1587 | pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; |
1587 | else | 1588 | else |
1588 | { | 1589 | { |
1590 | TRYFREE(pfile_in_zip_read_info->read_buffer); | ||
1589 | TRYFREE(pfile_in_zip_read_info); | 1591 | TRYFREE(pfile_in_zip_read_info); |
1590 | return err; | 1592 | return err; |
1591 | } | 1593 | } |
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index 4e611e1..66d693f 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c | |||
@@ -1471,11 +1471,6 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in | |||
1471 | { | 1471 | { |
1472 | uLong uTotalOutBefore = zi->ci.stream.total_out; | 1472 | uLong uTotalOutBefore = zi->ci.stream.total_out; |
1473 | err=deflate(&zi->ci.stream, Z_NO_FLUSH); | 1473 | err=deflate(&zi->ci.stream, Z_NO_FLUSH); |
1474 | if(uTotalOutBefore > zi->ci.stream.total_out) | ||
1475 | { | ||
1476 | int bBreak = 0; | ||
1477 | bBreak++; | ||
1478 | } | ||
1479 | 1474 | ||
1480 | zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; | 1475 | zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; |
1481 | } | 1476 | } |
@@ -1959,7 +1954,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe | |||
1959 | 1954 | ||
1960 | int retVal = ZIP_OK; | 1955 | int retVal = ZIP_OK; |
1961 | 1956 | ||
1962 | if(pData == NULL || *dataLen < 4) | 1957 | if(pData == NULL || dataLen == NULL || *dataLen < 4) |
1963 | return ZIP_PARAMERROR; | 1958 | return ZIP_PARAMERROR; |
1964 | 1959 | ||
1965 | pNewHeader = (char*)ALLOC((unsigned)*dataLen); | 1960 | pNewHeader = (char*)ALLOC((unsigned)*dataLen); |