diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-04-02 21:52:27 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2002-04-02 21:52:27 +0000 |
commit | 5a1f125f82fcb26e7f06912fa8e608c704f5ac29 (patch) | |
tree | 3879d9a539075e90586142ac97ecc7f7b34f1384 | |
parent | 8a90977770cc5cdf846e816644244b937955e904 (diff) |
Leave space for terminating NULL if empty symbol table. from bfd-current
via pr 2447; deraadt@ ok.
-rw-r--r-- | gnu/usr.bin/binutils/bfd/elf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils/bfd/elf.c b/gnu/usr.bin/binutils/bfd/elf.c index e8e7e3787ab..70ed24cc94e 100644 --- a/gnu/usr.bin/binutils/bfd/elf.c +++ b/gnu/usr.bin/binutils/bfd/elf.c @@ -4313,7 +4313,9 @@ _bfd_elf_get_symtab_upper_bound (abfd) Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr; symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym; - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); + symtab_size = (symcount + 1) * (sizeof (asymbol *)); + if (symcount > 0) + symtab_size -= sizeof (asymbol *); return symtab_size; } @@ -4333,7 +4335,9 @@ _bfd_elf_get_dynamic_symtab_upper_bound (abfd) } symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym; - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); + symtab_size = (symcount + 1) * (sizeof (asymbol *)); + if (symcount > 0) + symtab_size -= sizeof (asymbol *); return symtab_size; } |