Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Apr 2016 14:44:19 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r297822 - stable/10/lib/libelf
Message-ID:  <201604111444.u3BEiJbN080046@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604111444.u3BEiJbN080046>