mirror of
https://github.com/spiffcode/hostile-takeover.git
synced 2026-04-06 18:41:27 -06:00
Fix memory overwrite bug in memory manager
Surprising this has been in the code this long.
This commit is contained in:
parent
4874844ec2
commit
6a0c49d05e
@ -1041,7 +1041,11 @@ void MemMgr::WriteHeader(Heap *pheap, MemHeader *pmhdrDst, MemHeader *pmhdrSrc,
|
||||
memcpy(pmhdrDst, pmhdrSrc, cb);
|
||||
}
|
||||
#else
|
||||
memcpy(pmhdrDst, pmhdrSrc, cb);
|
||||
if (pmhdrSrc + cb <= pmhdrDst || pmhdrDst + cb <= pmhdrSrc) {
|
||||
memcpy(pmhdrDst, pmhdrSrc, cb);
|
||||
} else {
|
||||
memmove(pmhdrDst, pmhdrSrc, cb);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user