summaryrefslogtreecommitdiffstats
path: root/backends/aarch64_symbol.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-01-14 22:14:23 +0100
committerMark Wielaard <[email protected]>2014-01-17 22:01:54 +0100
commit0535e51470bb178aefce572851f8ce1c3921cc42 (patch)
tree4aea6eaa086348b4346afb880c66fe2e719c7e35 /backends/aarch64_symbol.c
parent04781c3e80412c7051b12dbdc58a642ab258cef0 (diff)
backends: aarch64_check_special_symbol check shdr is not NULL before usage.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'backends/aarch64_symbol.c')
-rw-r--r--backends/aarch64_symbol.c9
1 files changed, 6 insertions, 3 deletions
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;
+ }
}
}
}