]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(_dl_addr): Fix search algorithms in dladdr(); don't assume that the
authorUlrich Drepper <drepper@redhat.com>
Fri, 27 Feb 1998 18:00:37 +0000 (18:00 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 27 Feb 1998 18:00:37 +0000 (18:00 +0000)
number of program headers is >0 (which is wrong for the loader
itself).

elf/dladdr.c

index f3d63f76f2aa0c041b307c2cfcb3aceed99e767c..868a0ed893ff0e5c29b2e1d0b8c089c009572781 100644 (file)
@@ -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)