diff options
author | Daniel Dorau <d.dorau@avm.de> | 2022-03-04 11:14:18 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2022-03-10 13:01:38 +0100 |
commit | f372cab88d1f03411af8fec6dfa880ee6144140d (patch) | |
tree | dec3d0d113b929dcc638123b507af1e3445d4416 | |
parent | 118e211269fb4f685f2999157eb4aafc8fdd9423 (diff) |
dl-elf: Supress adding double '/' in library pathname
When searching for shared libraries, it could happen that redudant '/'
were added to the pathname with would later be reported via dladdr() in
the dli_fname member.
Signed-off-by: Daniel Dorau <d.dorau@avm.de>
-rw-r--r-- | ldso/ldso/dl-elf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 2bcfcda64..8210a012e 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -182,7 +182,10 @@ search_for_named_library(const char *name, unsigned int rflags, const char *path } else { _dl_strcpy(mylibname, "."); } - _dl_strcat(mylibname, "/"); + plen = _dl_strlen(mylibname); + if ((plen == 0) || (mylibname[plen-1] != '/')) { + _dl_strcat(mylibname, "/"); + } _dl_strcat(mylibname, name); #ifdef __LDSO_SAFE_RUNPATH__ if (*mylibname == '/') |