|
@@ -608,10 +608,16 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|
|
|
|
|
/* we check the magic */
|
|
/* we check the magic */
|
|
if (err==UNZ_OK)
|
|
if (err==UNZ_OK)
|
|
|
|
+ {
|
|
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
|
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
|
|
|
+ {
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
|
|
+ }
|
|
else if (uMagic!=0x02014b50)
|
|
else if (uMagic!=0x02014b50)
|
|
|
|
+ {
|
|
err=UNZ_BADZIPFILE;
|
|
err=UNZ_BADZIPFILE;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
|
|
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
@@ -688,18 +694,21 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|
uSizeRead = extraFieldBufferSize;
|
|
uSizeRead = extraFieldBufferSize;
|
|
|
|
|
|
if (lSeek!=0)
|
|
if (lSeek!=0)
|
|
|
|
+ {
|
|
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
|
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
|
lSeek=0;
|
|
lSeek=0;
|
|
else
|
|
else
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
|
|
+ }
|
|
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
|
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
|
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
|
|
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
lSeek += file_info.size_file_extra - uSizeRead;
|
|
lSeek += file_info.size_file_extra - uSizeRead;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
|
|
+ {
|
|
lSeek+=file_info.size_file_extra;
|
|
lSeek+=file_info.size_file_extra;
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
if ((err==UNZ_OK) && (szComment!=NULL))
|
|
if ((err==UNZ_OK) && (szComment!=NULL))
|
|
{
|
|
{
|
|
@@ -710,20 +719,26 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|
uSizeRead = file_info.size_file_comment;
|
|
uSizeRead = file_info.size_file_comment;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
|
|
+ {
|
|
uSizeRead = commentBufferSize;
|
|
uSizeRead = commentBufferSize;
|
|
|
|
+ }
|
|
|
|
|
|
if (lSeek!=0)
|
|
if (lSeek!=0)
|
|
|
|
+ {
|
|
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
|
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
|
lSeek=0;
|
|
lSeek=0;
|
|
else
|
|
else
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
|
|
+ }
|
|
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
|
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
|
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
|
|
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
lSeek+=file_info.size_file_comment - uSizeRead;
|
|
lSeek+=file_info.size_file_comment - uSizeRead;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
|
|
+ {
|
|
lSeek+=file_info.size_file_comment;
|
|
lSeek+=file_info.size_file_comment;
|
|
|
|
+ }
|
|
|
|
|
|
if ((err==UNZ_OK) && (pfile_info!=NULL))
|
|
if ((err==UNZ_OK) && (pfile_info!=NULL))
|
|
*pfile_info=file_info;
|
|
*pfile_info=file_info;
|
|
@@ -977,10 +992,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
|
|
|
|
|
|
|
|
|
if (err==UNZ_OK)
|
|
if (err==UNZ_OK)
|
|
|
|
+ {
|
|
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
|
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
else if (uMagic!=0x04034b50)
|
|
else if (uMagic!=0x04034b50)
|
|
err=UNZ_BADZIPFILE;
|
|
err=UNZ_BADZIPFILE;
|
|
|
|
+ }
|
|
|
|
|
|
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
|
|
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
|
|
err=UNZ_ERRNO;
|
|
err=UNZ_ERRNO;
|
|
@@ -1239,7 +1256,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
|
return UNZ_PARAMERROR;
|
|
return UNZ_PARAMERROR;
|
|
|
|
|
|
|
|
|
|
- if ((pfile_in_zip_read_info->read_buffer == NULL))
|
|
|
|
|
|
+ if (pfile_in_zip_read_info->read_buffer == NULL)
|
|
return UNZ_END_OF_LIST_OF_FILE;
|
|
return UNZ_END_OF_LIST_OF_FILE;
|
|
if (len==0)
|
|
if (len==0)
|
|
return 0;
|
|
return 0;
|