From: Rich Felker Date: Mon, 27 Jun 2011 01:36:44 +0000 (-0400) Subject: in dlopen: don't use null pointer X-Git-Tag: v0.7.11~13 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0e4dae3d77f67bed0cd29c98b67b86c7d9853ac9;p=oweals%2Fmusl.git in dlopen: don't use null pointer deps can be null if a library has no dependencies (such as libc itself) --- diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 305d70e0..a23390e1 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -514,19 +514,19 @@ void *dlopen(const char *file, int mode) /* First load handling */ if (!p->deps) { load_deps(p); - for (i=0; p->deps[i]; i++) + if (p->deps) for (i=0; p->deps[i]; i++) if (!p->deps[i]->global) p->deps[i]->global = -1; if (!p->global) p->global = -1; reloc_all(p); - for (i=0; p->deps[i]; i++) + if (p->deps) for (i=0; p->deps[i]; i++) if (p->deps[i]->global < 0) p->deps[i]->global = 0; if (p->global < 0) p->global = 0; } if (mode & RTLD_GLOBAL) { - for (i=0; p->deps[i]; i++) + if (p->deps) for (i=0; p->deps[i]; i++) p->deps[i]->global = 1; p->global = 1; }