From: Ulrich Drepper Date: Tue, 7 Jul 1998 12:00:24 +0000 (+0000) Subject: Fix problem with empty LD_PRELOAD value. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d2e37472f31f23c75470fb0402edd019edbc8f6;p=thirdparty%2Fglibc.git Fix problem with empty LD_PRELOAD value. --- diff --git a/elf/rtld.c b/elf/rtld.c index 9f6f1136f3d..e26e4574ad5 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -364,7 +364,8 @@ of this helper program; chances are you did not intend to run this program.\n", containing a '/' are ignored since it is insecure. */ char *list = strdupa (preloadlist); char *p; - while ((p = strsep (&list, " :")) != NULL) + list += strspn (list, " :"); + while (*list && (p = strsep (&list, " :")) != NULL) if (! __libc_enable_secure || strchr (p, '/') == NULL) { struct link_map *new_map = _dl_map_object (l, p, 1, lt_library, 0); @@ -372,6 +373,8 @@ of this helper program; chances are you did not intend to run this program.\n", /* It is no duplicate. */ ++npreloads; } + if (list != NULL) + list += strspn (list, " :"); } /* Read the contents of the file. */ @@ -427,7 +430,7 @@ of this helper program; chances are you did not intend to run this program.\n", { char *p; runp = file + strspn (file, ": \t\n"); - while ((p = strsep (&runp, ": \t\n")) != NULL) + while (*runp && (p = strsep (&runp, ": \t\n")) != NULL) { struct link_map *new_map = _dl_map_object (l, p, 1, lt_library, 0);