1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

memmove instead of overlapping memcpy

This commit is contained in:
John Reiser 2010-03-08 22:01:25 -08:00
parent 1e2cb279b0
commit ffb60d5149

View File

@ -220,7 +220,7 @@ void PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
// Rotate to highest position, so it can be lopped
// by decrementing e_phnum.
memcpy((unsigned char *)ibuf, phdr, sizeof(*phdr));
memcpy(phdr, 1+phdr, j * sizeof(*phdr));
memmove(phdr, 1+phdr, j * sizeof(*phdr)); // overlapping
memcpy(&phdr[j], (unsigned char *)ibuf, sizeof(*phdr));
--phdr;
set_te16(&ehdri.e_phnum, --e_phnum);