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
This commit is contained in:
Ed Maste 2020-03-05 20:53:43 +00:00
parent d8c51c6f74
commit 2f7242ed33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358685

View file

@ -1022,7 +1022,7 @@ _libelf_cvt_NOTE_tof(unsigned char *dst, size_t dsz, unsigned char *src,
count -= sizeof(Elf_Note);
if (count < sz)
sz = count;
return (0);
(void) memcpy(dst, src, sz);