From: Ulrich Drepper Date: Fri, 27 Feb 1998 18:00:37 +0000 (+0000) Subject: (_dl_addr): Fix search algorithms in dladdr(); don't assume that the X-Git-Tag: cvs/before-sparc-2_0_x-branch~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8f3c5894ee8053ea9f6049a5a0689c9efba1685;p=thirdparty%2Fglibc.git (_dl_addr): Fix search algorithms in dladdr(); don't assume that the number of program headers is >0 (which is wrong for the loader itself). --- diff --git a/elf/dladdr.c b/elf/dladdr.c index f3d63f76f2a..868a0ed893f 100644 --- a/elf/dladdr.c +++ b/elf/dladdr.c @@ -68,10 +68,11 @@ dladdr (void *address, Dl_info *info) /* We assume that the string table follows the symbol table, because there is no way in ELF to know the size of the dynamic symbol table!! */ for (matchsym = NULL; (void *) symtab < (void *) strtab; ++symtab) - if (addr >= match->l_addr + symtab->st_value && !matchsym || - matchsym->st_value < symtab->st_value && - ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL || - ELFW(ST_BIND) (symtab->st_info) == STB_WEAK) + if (addr >= match->l_addr + symtab->st_value + && (!matchsym + || (matchsym->st_value < symtab->st_value + && (ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL + || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)))) matchsym = symtab; if (matchsym)