diff options
author | Mark Wielaard <mjw@redhat.com> | 2014-01-14 22:14:23 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2014-01-17 22:01:54 +0100 |
commit | 0535e51470bb178aefce572851f8ce1c3921cc42 (patch) | |
tree | 4aea6eaa086348b4346afb880c66fe2e719c7e35 | |
parent | 04781c3e80412c7051b12dbdc58a642ab258cef0 (diff) | |
download | elfutils-0535e51470bb178aefce572851f8ce1c3921cc42.tar.gz |
backends: aarch64_check_special_symbol check shdr is not NULL before usage.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r-- | backends/ChangeLog | 5 | ||||
-rw-r--r-- | backends/aarch64_symbol.c | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 4ea1acd2..a742eb25 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2014-01-14 Mark Wielaard <mjw@redhat.com> + + * aarch64_symbol.c (aarch64_check_special_symbol): Check shdr is + not NULL before usage. + 2014-01-04 Mark Wielaard <mjw@redhat.com> * ppc64_symbol.c (ppc64_machine_flag_check): New function. diff --git a/backends/aarch64_symbol.c b/backends/aarch64_symbol.c index e41a7a7d..3fdc9cf8 100644 --- a/backends/aarch64_symbol.c +++ b/backends/aarch64_symbol.c @@ -73,9 +73,12 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, { GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name); - if (sname != NULL && strcmp (sname, ".got") == 0) - return sym->st_value == shdr->sh_addr; + if (shdr != NULL) + { + sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name); + if (sname != NULL && strcmp (sname, ".got") == 0) + return sym->st_value == shdr->sh_addr; + } } } } |