Security and warning fixes for minizip. [gvollant]
Remove unused code and unnecessary test for free().
This commit is contained in:
parent
9b291c9f01
commit
138c93cffb
@ -112,7 +112,7 @@
|
||||
# define ALLOC(size) (malloc(size))
|
||||
#endif
|
||||
#ifndef TRYFREE
|
||||
# define TRYFREE(p) {if (p) free(p);}
|
||||
# define TRYFREE(p) { free(p);}
|
||||
#endif
|
||||
|
||||
#define SIZECENTRALDIRITEM (0x2e)
|
||||
@ -1566,6 +1566,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||
pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED;
|
||||
else
|
||||
{
|
||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
||||
TRYFREE(pfile_in_zip_read_info);
|
||||
return err;
|
||||
}
|
||||
@ -1586,6 +1587,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
|
||||
else
|
||||
{
|
||||
TRYFREE(pfile_in_zip_read_info->read_buffer);
|
||||
TRYFREE(pfile_in_zip_read_info);
|
||||
return err;
|
||||
}
|
||||
|
@ -1471,11 +1471,6 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||
{
|
||||
uLong uTotalOutBefore = zi->ci.stream.total_out;
|
||||
err=deflate(&zi->ci.stream, Z_NO_FLUSH);
|
||||
if(uTotalOutBefore > zi->ci.stream.total_out)
|
||||
{
|
||||
int bBreak = 0;
|
||||
bBreak++;
|
||||
}
|
||||
|
||||
zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
|
||||
}
|
||||
@ -1959,7 +1954,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
||||
|
||||
int retVal = ZIP_OK;
|
||||
|
||||
if(pData == NULL || *dataLen < 4)
|
||||
if(pData == NULL || dataLen == NULL || *dataLen < 4)
|
||||
return ZIP_PARAMERROR;
|
||||
|
||||
pNewHeader = (char*)ALLOC((unsigned)*dataLen);
|
||||
|
Loading…
Reference in New Issue
Block a user