Fix out of bounds memory access when trying to allocate space for a note of size -1.

PR 21933
	* elf.c (elf_read_notes): Check for a note size of -1.
This commit is contained in:
Nick Clifton 2017-08-10 09:37:36 +01:00
parent 3ecaa9fd72
commit 957e1fc1c5
1 changed files with 1 additions and 1 deletions

View File

@ -10997,7 +10997,7 @@ elf_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
{
char *buf;
if (size <= 0)
if (size == 0 || (size + 1) == 0)
return TRUE;
if (bfd_seek (abfd, offset, SEEK_SET) != 0)