aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 6e1ab96..458c679 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -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