mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-13 07:57:35 +00:00
Make the elf parser use the phdrs and the DT_DYNAMIC contents
This commit is contained in:
parent
5bdbfd240a
commit
f990b078a8
@ -308,11 +308,22 @@ static int Elf_(r_bin_elf_init_strtab)(struct Elf_(r_bin_elf_obj_t) *bin) {
|
||||
} else {
|
||||
Elf_(Shdr) *sh = Elf_(r_bin_elf_get_section_by_name) (bin, ".strtab");
|
||||
if (!sh) {
|
||||
eprintf ("Warning: strtab section not found\n");
|
||||
return R_FALSE;
|
||||
// Try using the DYNAMIC headers to get the strtab section
|
||||
// but only if the binary has no section headers
|
||||
dyn_strtab = Elf_(r_bin_elf_seek_dyn_tag) (bin, DT_STRTAB);
|
||||
dyn_strsz = Elf_(r_bin_elf_seek_dyn_tag) (bin, DT_STRSZ);
|
||||
|
||||
if (dyn_strtab && dyn_strsz) {
|
||||
off = dyn_strtab->d_un.d_val - bin->baddr;
|
||||
size = dyn_strsz->d_un.d_val;
|
||||
} else {
|
||||
eprintf ("Could not find a suitable strtab section\n");
|
||||
return R_FALSE;
|
||||
}
|
||||
} else {
|
||||
off = sh->sh_offset;
|
||||
size = sh->sh_size;
|
||||
}
|
||||
off = sh->sh_offset;
|
||||
size = sh->sh_size;
|
||||
}
|
||||
|
||||
bin->strtab_size = size;
|
||||
|
Loading…
Reference in New Issue
Block a user