Skip to content

Commit

Permalink
Limit the archive offset detection to files
Browse files Browse the repository at this point in the history
It makes sense to avoid changing the offset and/or the archive size when
the user specifies a buffer rather than a file.
  • Loading branch information
LemonBoy committed Jun 10, 2024
1 parent 0283a17 commit 961de84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion miniz_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static int mz_stat64(const char *path, struct __stat64 *buffer)
}

/* Update the archive start position, but only if not specified. */
if (pZip->m_pState->m_file_archive_start_ofs == 0)
if ((pZip->m_zip_type == MZ_ZIP_TYPE_FILE || pZip->m_zip_type == MZ_ZIP_TYPE_CFILE) && pZip->m_pState->m_file_archive_start_ofs == 0)
{
pZip->m_pState->m_file_archive_start_ofs = archive_ofs;
pZip->m_archive_size -= archive_ofs;
Expand Down

0 comments on commit 961de84

Please sign in to comment.