Fix reading numeric values from GNU BUILD NOTEs.

* readelf.c (print_gnu_build_attribute_name): Read byte values
	from the name string as unsigned bytes.
	(process_notes_at): Use memcpy to copy an unterminated name
	string.
This commit is contained in:
Nick Clifton 2017-03-06 17:21:04 +00:00
parent 73f07bffaf
commit 79a964dca5
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2017-03-06 Nick Clifton <nickc@redhat.com>
* readelf.c (print_gnu_build_attribute_name): Read byte values
from the name string as unsigned bytes.
(process_notes_at): Use memcpy to copy an unterminated name
string.
2017-03-06 Sam Thursfield <sam.thursfield@codethink.co.uk>
* configure.ac (AC_CHECK_DECLS): Add asprintf.

View File

@ -16768,7 +16768,9 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote)
while (bytes --)
{
val |= ((* name ++) << shift);
unsigned long byte = (* name ++) & 0xff;
val |= byte << shift;
shift += 8;
}
@ -17042,7 +17044,7 @@ process_notes_at (FILE * file,
break;
}
strncpy (temp, inote.namedata, inote.namesz);
memcpy (temp, inote.namedata, inote.namesz);
temp[inote.namesz] = 0;
/* warn (_("'%s' NOTE name not properly null terminated\n"), temp); */