Fixed stack smashing in newly-aligned __PHYSFS_smallAlloc().

This commit is contained in:
Ryan C. Gordon 2012-03-12 01:33:16 -04:00
parent 1d41608a64
commit 5ad70036b2
1 changed files with 3 additions and 2 deletions

View File

@ -80,8 +80,9 @@ extern "C" {
void *__PHYSFS_initSmallAlloc(void *ptr, PHYSFS_uint64 len);
#define __PHYSFS_smallAlloc(bytes) ( \
__PHYSFS_initSmallAlloc((((bytes) < __PHYSFS_SMALLALLOCTHRESHOLD) ? \
alloca((size_t)((bytes)+1)) : NULL), (bytes)) \
__PHYSFS_initSmallAlloc( \
(((bytes) < __PHYSFS_SMALLALLOCTHRESHOLD) ? \
alloca((size_t)((bytes)+sizeof(void*))) : NULL), (bytes)) \
)
void __PHYSFS_smallFree(void *ptr);