memmove instead of overlapping memcpy

This commit is contained in:
John Reiser
2010-03-08 22:01:25 -08:00
parent 1e2cb279b0
commit ffb60d5149
+1 -1
View File
@@ -220,7 +220,7 @@ void PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
// Rotate to highest position, so it can be lopped // Rotate to highest position, so it can be lopped
// by decrementing e_phnum. // by decrementing e_phnum.
memcpy((unsigned char *)ibuf, phdr, sizeof(*phdr)); 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)); memcpy(&phdr[j], (unsigned char *)ibuf, sizeof(*phdr));
--phdr; --phdr;
set_te16(&ehdri.e_phnum, --e_phnum); set_te16(&ehdri.e_phnum, --e_phnum);