diff options
author | Mike Frysinger <vapier@gentoo.org> | 2017-01-24 10:22:26 -1000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2017-01-24 10:22:26 -1000 |
commit | 6a73ea4e32cc6ff6d1814048368b7b75da626565 (patch) | |
tree | ee88a473cabfab0b40b1e06af6ad7b5ae9e0ba87 /scanelf.c | |
parent | scanelf: switch all string table lookups to scanelf_file_get_symtabs (diff) | |
download | pax-utils-6a73ea4e32cc6ff6d1814048368b7b75da626565.tar.gz pax-utils-6a73ea4e32cc6ff6d1814048368b7b75da626565.tar.bz2 pax-utils-6a73ea4e32cc6ff6d1814048368b7b75da626565.zip |
scanelf: revert back to looking at .dynstr directly
The rpath/needed/soname strings are only listed in .dynstr, so trying
to locate them in .strtab fails. Which means using the lookup helper
breaks behavior on non-stripped files.
Diffstat (limited to 'scanelf.c')
-rw-r--r-- | scanelf.c | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -767,11 +767,16 @@ static void rpath_security_checks(elfobj *elf, char *item, const char *dt_type) static void scanelf_file_rpath(elfobj *elf, char *found_rpath, char **ret, size_t *ret_len) { char *rpath, *runpath, **r; - void *symtab_void, *strtab_void; + void *strtab_void; if (!show_rpath) return; - scanelf_file_get_symtabs(elf, &symtab_void, &strtab_void); + /* + * TODO: Switch to the string table found via dynamic tags. + * Note: We can't use scanelf_file_get_symtabs as these strings are + * *only* found in dynstr and not in .strtab. + */ + strtab_void = elf_findsecbyname(elf, ".dynstr"); rpath = runpath = NULL; #define SHOW_RPATH(B) \ @@ -913,7 +918,7 @@ static char *lookup_config_lib(const char *fname) static const char *scanelf_file_needed_lib(elfobj *elf, char *found_needed, char *found_lib, int op, char **ret, size_t *ret_len) { char *needed; - void *symtab_void, *strtab_void; + void *strtab_void; char *p; /* @@ -923,7 +928,12 @@ static const char *scanelf_file_needed_lib(elfobj *elf, char *found_needed, char if ((op == 0 && !show_needed) || (op == 1 && !find_lib)) return NULL; - scanelf_file_get_symtabs(elf, &symtab_void, &strtab_void); + /* + * TODO: Switch to the string table found via dynamic tags. + * Note: We can't use scanelf_file_get_symtabs as these strings are + * *only* found in dynstr and not in .strtab. + */ + strtab_void = elf_findsecbyname(elf, ".dynstr"); #define SHOW_NEEDED(B) \ Elf ## B ## _Dyn *dyn; \ @@ -1059,11 +1069,16 @@ static const char *scanelf_file_bind(elfobj *elf, char *found_bind) static char *scanelf_file_soname(elfobj *elf, char *found_soname) { char *soname; - void *symtab_void, *strtab_void; + void *strtab_void; if (!show_soname) return NULL; - scanelf_file_get_symtabs(elf, &symtab_void, &strtab_void); + /* + * TODO: Switch to the string table found via dynamic tags. + * Note: We can't use scanelf_file_get_symtabs as these strings are + * *only* found in dynstr and not in .strtab. + */ + strtab_void = elf_findsecbyname(elf, ".dynstr"); #define SHOW_SONAME(B) \ Elf ## B ## _Dyn *dyn; \ |