Fixed infinite loop (thanks, Sam!)

This commit is contained in:
Ryan C. Gordon 2012-09-08 22:18:52 -04:00
parent 986c40ac6a
commit 13855849e6
1 changed files with 2 additions and 2 deletions

View File

@ -1184,14 +1184,14 @@ static PHYSFS_sint64 zip64_find_end_of_central_dir(PHYSFS_Io *io,
/* we assume you can eat this stack if you handle Zip64 files. */
PHYSFS_uint8 buf[256 * 1024];
PHYSFS_uint64 len = pos - offset;
PHYSFS_uint32 i;
PHYSFS_sint32 i;
if (len > sizeof (buf))
len = sizeof (buf);
BAIL_IF_MACRO(!io->seek(io, pos - len), ERRPASS, -1);
BAIL_IF_MACRO(!__PHYSFS_readAll(io, buf, len), ERRPASS, -1);
for (i = len - 4; i >= 0; i--)
for (i = (PHYSFS_sint32) (len - 4); i >= 0; i--)
{
if (buf[i] != 0x50)
continue;