Fixed realloc(3) bug causing buffer overruns.
This commit is contained in:
parent
bd7cb5195a
commit
cde10097e6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue