Fixed realloc(3) bug causing buffer overruns.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-03-07 20:52:44 +01:00
parent bd7cb5195a
commit cde10097e6
1 changed files with 1 additions and 1 deletions

View File

@ -662,7 +662,7 @@ namespace Maxsi
ASSERT(chunk->IsUsed());
ASSERT(chunk->IsSane());
size_t allocsize = chunk->size - OVERHEAD;
if ( allocsize < size ) { return ptr; }
if ( size < allocsize ) { return ptr; }
void* newptr = Allocate(size);
if ( !newptr ) { return NULL; }
Memory::Copy(newptr, ptr, allocsize);