1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

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

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);