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);
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to