diff options
author | Alan Modra <amodra@gmail.com> | 2007-05-14 04:15:53 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-05-14 04:15:53 +0000 |
commit | 74f2e02bf4ceb4b0f1440f4eba247a467c45ed35 (patch) | |
tree | 5dfae5c8652cc4cae95d1fe949dedcbe313b8e8d /bfd/elf.c | |
parent | a1513dafcc7172b4fb5fe771acd7cfa3fb4a58b7 (diff) | |
download | gdb-74f2e02bf4ceb4b0f1440f4eba247a467c45ed35.zip gdb-74f2e02bf4ceb4b0f1440f4eba247a467c45ed35.tar.gz gdb-74f2e02bf4ceb4b0f1440f4eba247a467c45ed35.tar.bz2 |
* elf.c (bfd_elf_string_from_elf_section): Return NULL on
invalid shstrndx.
(bfd_elf_get_str_section): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -252,7 +252,9 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) bfd_size_type shstrtabsize; i_shdrp = elf_elfsections (abfd); - if (i_shdrp == 0 || i_shdrp[shindex] == 0) + if (i_shdrp == 0 + || shindex >= elf_numsections (abfd) + || i_shdrp[shindex] == 0) return NULL; shstrtab = i_shdrp[shindex]->contents; @@ -291,6 +293,9 @@ bfd_elf_string_from_elf_section (bfd *abfd, if (strindex == 0) return ""; + if (elf_elfsections (abfd) == NULL || shindex >= elf_numsections (abfd)) + return NULL; + hdr = elf_elfsections (abfd)[shindex]; if (hdr->contents == NULL |