aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-01-06 22:02:55 +0000
committerNick Clifton <nickc@redhat.com>2015-01-06 22:02:55 +0000
commite7287c7f647870093b8ab5ffea0732ffdb8c4d66 (patch)
treec72a8047b5947aa011171b8c7c1989ecd13e682a /bfd/mach-o.c
parente749cab89d976c723ee01a3dfcfd7ec1a883f890 (diff)
downloadgdb-e7287c7f647870093b8ab5ffea0732ffdb8c4d66.zip
gdb-e7287c7f647870093b8ab5ffea0732ffdb8c4d66.tar.gz
gdb-e7287c7f647870093b8ab5ffea0732ffdb8c4d66.tar.bz2
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.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 5dd6250..44b12b5 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -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;