diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-02-27 18:32:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-02-27 18:32:03 +0000 |
commit | f024c19647c20b3529372cb41682b4cf962447c4 (patch) | |
tree | 92d528f2c61b8e3d638cfda4b0f5d7304d3a758d /elf/dl-addr.c | |
parent | 227d9931ef8b8c9879e14fab19ee134411a04d5e (diff) | |
download | glibc-f024c19647c20b3529372cb41682b4cf962447c4.zip glibc-f024c19647c20b3529372cb41682b4cf962447c4.tar.gz glibc-f024c19647c20b3529372cb41682b4cf962447c4.tar.bz2 |
Update.
* misc/syslog.c: Change to allow user the interpretation of the
outcome even with syslog having no return value.
1998-02-05 20:41 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
* elf/dl-addr.c: Fix search algorithms in dladdr(); don't assume
that the number of program headers is >0 (which is wrong for the
loader itself).
1998-02-27 Ulrich Drepper <drepper@cygnus.com>
Diffstat (limited to 'elf/dl-addr.c')
-rw-r--r-- | elf/dl-addr.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/elf/dl-addr.c b/elf/dl-addr.c index baa6df5..4d78738 100644 --- a/elf/dl-addr.c +++ b/elf/dl-addr.c @@ -1,5 +1,5 @@ /* Locate the shared object symbol nearest a given address. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -41,13 +41,16 @@ _dl_addr (const void *address, Dl_info *info) /* We know ADDRESS lies within MATCH if in any shared object. Make sure it isn't past the end of MATCH's segments. */ size_t n = match->l_phnum; - do - --n; - while (match->l_phdr[n].p_type != PT_LOAD); - if (addr >= (match->l_addr + - match->l_phdr[n].p_vaddr + match->l_phdr[n].p_memsz)) - /* Off the end of the highest-addressed shared object. */ - return 0; + if (n > 0) + { + do + --n; + while (match->l_phdr[n].p_type != PT_LOAD); + if (addr >= (match->l_addr + + match->l_phdr[n].p_vaddr + match->l_phdr[n].p_memsz)) + /* Off the end of the highest-addressed shared object. */ + return 0; + } } else return 0; |