Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2020 20:53:43 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358685 - head/contrib/elftoolchain/libelf
Message-ID:  <202003052053.025KrhMs080333@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Mar  5 20:53:43 2020
New Revision: 358685
URL: https://svnweb.freebsd.org/changeset/base/358685

Log:
  libelf: rationalize error handling in ELF note conversion
  
  Previously _libelf_cvt_NOTE_tom (to host) returned false if a note's
  namesz + descsz exceeded the buffer size, while _libelf_cvt_NOTE_tof
  (to file) silently truncated.  Return false in the latter case too.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/libelf/libelf_convert.m4

Modified: head/contrib/elftoolchain/libelf/libelf_convert.m4
==============================================================================
--- head/contrib/elftoolchain/libelf/libelf_convert.m4	Thu Mar  5 20:04:41 2020	(r358684)
+++ head/contrib/elftoolchain/libelf/libelf_convert.m4	Thu Mar  5 20:53:43 2020	(r358685)
@@ -1022,7 +1022,7 @@ _libelf_cvt_NOTE_tof(unsigned char *dst, size_t dsz, u
 		count -= sizeof(Elf_Note);
 
 		if (count < sz)
-			sz = count;
+			return (0);
 
 		(void) memcpy(dst, src, sz);
 



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