Skip to content

Commit

Permalink
Fixed stack smashing in newly-aligned __PHYSFS_smallAlloc().
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 12, 2012
1 parent 1d41608 commit 5ad7003
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/physfs_internal.h
Expand Up @@ -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);
Expand Down

0 comments on commit 5ad7003

Please sign in to comment.