Lines 375-387
Link Here
|
375 |
static PHYSFS_sint64 zip_find_end_of_central_dir(void *in, PHYSFS_sint64 *len) |
375 |
static PHYSFS_sint64 zip_find_end_of_central_dir(void *in, PHYSFS_sint64 *len) |
376 |
{ |
376 |
{ |
377 |
PHYSFS_uint8 buf[256]; |
377 |
PHYSFS_uint8 buf[256]; |
|
|
378 |
PHYSFS_uint8 extra[4]; |
378 |
PHYSFS_sint32 i = 0; |
379 |
PHYSFS_sint32 i = 0; |
379 |
PHYSFS_sint64 filelen; |
380 |
PHYSFS_sint64 filelen; |
380 |
PHYSFS_sint64 filepos; |
381 |
PHYSFS_sint64 filepos; |
381 |
PHYSFS_sint32 maxread; |
382 |
PHYSFS_sint32 maxread; |
382 |
PHYSFS_sint32 totalread = 0; |
383 |
PHYSFS_sint32 totalread = 0; |
383 |
int found = 0; |
384 |
int found = 0; |
384 |
PHYSFS_uint32 extra = 0; |
|
|
385 |
|
385 |
|
386 |
filelen = __PHYSFS_platformFileLength(in); |
386 |
filelen = __PHYSFS_platformFileLength(in); |
387 |
BAIL_IF_MACRO(filelen == -1, NULL, 0); /* !!! FIXME: unlocalized string */ |
387 |
BAIL_IF_MACRO(filelen == -1, NULL, 0); /* !!! FIXME: unlocalized string */ |
Lines 419-425
Link Here
|
419 |
{ |
419 |
{ |
420 |
if (__PHYSFS_platformRead(in, buf, maxread - 4, 1) != 1) |
420 |
if (__PHYSFS_platformRead(in, buf, maxread - 4, 1) != 1) |
421 |
return(-1); |
421 |
return(-1); |
422 |
*((PHYSFS_uint32 *) (&buf[maxread - 4])) = extra; |
422 |
memcpy(&buf[maxread - 4], &extra, sizeof (extra)); |
423 |
totalread += maxread - 4; |
423 |
totalread += maxread - 4; |
424 |
} /* if */ |
424 |
} /* if */ |
425 |
else |
425 |
else |
Lines 429-435
Link Here
|
429 |
totalread += maxread; |
429 |
totalread += maxread; |
430 |
} /* else */ |
430 |
} /* else */ |
431 |
|
431 |
|
432 |
extra = *((PHYSFS_uint32 *) (&buf[0])); |
432 |
memcpy(&extra, buf, sizeof (extra)); |
433 |
|
433 |
|
434 |
for (i = maxread - 4; i > 0; i--) |
434 |
for (i = maxread - 4; i > 0; i--) |
435 |
{ |
435 |
{ |