mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 07:12:15 +00:00
fix ldso reserved library name handling
If a DT_NEEDED entry was the prefix of a reserved library name (up to the first dot) then it was incorrectly treated as a libc reserved name. e.g. libp.so dependency was not loaded as it matched libpthread reserved name.
This commit is contained in:
parent
86e8cc0fd4
commit
5ffe515ca4
@ -906,12 +906,13 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
|||||||
/* Catch and block attempts to reload the implementation itself */
|
/* Catch and block attempts to reload the implementation itself */
|
||||||
if (name[0]=='l' && name[1]=='i' && name[2]=='b') {
|
if (name[0]=='l' && name[1]=='i' && name[2]=='b') {
|
||||||
static const char reserved[] =
|
static const char reserved[] =
|
||||||
"c\0pthread\0rt\0m\0dl\0util\0xnet\0";
|
"c.pthread.rt.m.dl.util.xnet.";
|
||||||
const char *rp;
|
const char *rp, *next;
|
||||||
char *z = strchr(name, '.');
|
for (rp=reserved; *rp; rp=next) {
|
||||||
if (z) {
|
next = strchr(rp, '.') + 1;
|
||||||
size_t l = z-name;
|
if (strncmp(name+3, rp, next-rp) == 0)
|
||||||
for (rp=reserved; *rp && strncmp(name+3, rp, l-3); rp+=strlen(rp)+1);
|
break;
|
||||||
|
}
|
||||||
if (*rp) {
|
if (*rp) {
|
||||||
if (ldd_mode) {
|
if (ldd_mode) {
|
||||||
/* Track which names have been resolved
|
/* Track which names have been resolved
|
||||||
@ -928,7 +929,6 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
|||||||
is_self = 1;
|
is_self = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!strcmp(name, ldso.name)) is_self = 1;
|
if (!strcmp(name, ldso.name)) is_self = 1;
|
||||||
if (is_self) {
|
if (is_self) {
|
||||||
if (!ldso.prev) {
|
if (!ldso.prev) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user