svn commit: r297822 - stable/10/lib/libelf
Ed Maste
emaste at FreeBSD.org
Mon Apr 11 14:44:20 UTC 2016
Author: emaste
Date: Mon Apr 11 14:44:18 2016
New Revision: 297822
URL: https://svnweb.freebsd.org/changeset/base/297822
Log:
MFC r275430: libelf: Fix cross-endian ELF note file / memory conversion
The namesz and descsz variables need to be used in native endianness.
The sizes are in native order after swapping in the file to memory case,
and before swapping in the memory to file case.
This change is not identical to r275430 because r273443 was never merged
to stable/10, and libelf moved from lib/ to contrib/elftoolchain/.
Modified:
stable/10/lib/libelf/libelf_convert.m4
Modified: stable/10/lib/libelf/libelf_convert.m4
==============================================================================
--- stable/10/lib/libelf/libelf_convert.m4 Mon Apr 11 14:26:02 2016 (r297821)
+++ stable/10/lib/libelf/libelf_convert.m4 Mon Apr 11 14:44:18 2016 (r297822)
@@ -796,6 +796,11 @@ libelf_cvt_NOTE_tof(char *dst, size_t ds
descsz = en->n_descsz;
type = en->n_type;
+ sz = namesz;
+ ROUNDUP2(sz, 4);
+ sz += descsz;
+ ROUNDUP2(sz, 4);
+
SWAP_WORD(namesz);
SWAP_WORD(descsz);
SWAP_WORD(type);
@@ -806,11 +811,6 @@ libelf_cvt_NOTE_tof(char *dst, size_t ds
src += sizeof(Elf_Note);
- ROUNDUP2(namesz, 4);
- ROUNDUP2(descsz, 4);
-
- sz = namesz + descsz;
-
if (count < sz)
sz = count;
More information about the svn-src-all
mailing list