mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
Another fix for an objdump crash when parsing a corrupt binary.
PR binutils/17512 * mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the string table.
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
2015-01-06 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/17512
|
||||
* mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the
|
||||
string table.
|
||||
|
||||
* reloc.c (bfd_get_reloc_size): Handle a reloc size of -1.
|
||||
(bfd_perform_relocation): Include the size of the reloc in the
|
||||
test for an out of range relocation.
|
||||
|
@ -3675,7 +3675,7 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd)
|
||||
}
|
||||
else
|
||||
{
|
||||
sym->strtab = bfd_alloc (abfd, sym->strsize);
|
||||
sym->strtab = bfd_alloc (abfd, sym->strsize + 1);
|
||||
if (sym->strtab == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -3688,6 +3688,8 @@ bfd_mach_o_read_symtab_strtab (bfd *abfd)
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
return FALSE;
|
||||
}
|
||||
/* Zero terminate the string table. */
|
||||
sym->strtab[sym->strsize] = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
Reference in New Issue
Block a user