Skip to content

Commit

Permalink
Merge pull request ZipArchive#402 from ZipArchive/IncorrectHeaders
Browse files Browse the repository at this point in the history
hotfix for unzipping (fix ZipArchive#391)
  • Loading branch information
Coeur authored Oct 11, 2017
2 parents 5b9e60e + 4ae03a2 commit 8e3a03d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions SSZipArchive/minizip/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,9 +1297,12 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, uint32_t len)
s->pfile_in_zip_read->stream.next_out = (uint8_t*)buf;
s->pfile_in_zip_read->stream.avail_out = (uint16_t)len;

if (len > s->pfile_in_zip_read->rest_read_compressed + s->pfile_in_zip_read->stream.avail_in)
s->pfile_in_zip_read->stream.avail_out = (uint16_t)s->pfile_in_zip_read->rest_read_compressed +
s->pfile_in_zip_read->stream.avail_in;
if ((s->pfile_in_zip_read->compression_method == 0) || (s->pfile_in_zip_read->raw))
{
if (len > s->pfile_in_zip_read->rest_read_compressed + s->pfile_in_zip_read->stream.avail_in)
s->pfile_in_zip_read->stream.avail_out = (uint16_t)s->pfile_in_zip_read->rest_read_compressed +
s->pfile_in_zip_read->stream.avail_in;
}

do
{
Expand Down

0 comments on commit 8e3a03d

Please sign in to comment.