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:
parent
bd7cb5195a
commit
cde10097e6
1 changed files with 1 additions and 1 deletions
|
@ -662,7 +662,7 @@ namespace Maxsi
|
||||||
ASSERT(chunk->IsUsed());
|
ASSERT(chunk->IsUsed());
|
||||||
ASSERT(chunk->IsSane());
|
ASSERT(chunk->IsSane());
|
||||||
size_t allocsize = chunk->size - OVERHEAD;
|
size_t allocsize = chunk->size - OVERHEAD;
|
||||||
if ( allocsize < size ) { return ptr; }
|
if ( size < allocsize ) { return ptr; }
|
||||||
void* newptr = Allocate(size);
|
void* newptr = Allocate(size);
|
||||||
if ( !newptr ) { return NULL; }
|
if ( !newptr ) { return NULL; }
|
||||||
Memory::Copy(newptr, ptr, allocsize);
|
Memory::Copy(newptr, ptr, allocsize);
|
||||||
|
|
Loading…
Add table
Reference in a new issue