Do not interpret an empty path as current working directory "." when
authorbenno <benno@openbsd.org>
Thu, 22 Jun 2017 20:44:36 +0000 (20:44 +0000)
committerbenno <benno@openbsd.org>
Thu, 22 Jun 2017 20:44:36 +0000 (20:44 +0000)
parsing LD_LIBRARY_PATH, and in DT_RPATH and DT_RUNPATH attributes and
in ld.so.hints.

ok deraadt@

libexec/ld.so/path.c

index 34a52db..f0dd706 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: path.c,v 1.6 2015/05/22 13:48:25 jsg Exp $    */
+/*     $OpenBSD: path.c,v 1.7 2017/06/22 20:44:36 benno Exp $  */
 
 /*
  * Copyright (c) 2013 Kurt Miller <kurt@intricatesoftware.com>
@@ -52,14 +52,7 @@ _dl_split_path(const char *searchpath)
                while (*pp != '\0' && *pp != ':' && *pp != ';')
                        pp++;
 
-               /* interpret "" as curdir "." */
-               if (p_begin == pp) {
-                       retval[pos] = _dl_malloc(2);
-                       if (retval[pos] == NULL)
-                               goto badret;
-
-                       _dl_bcopy(".", retval[pos++], 2);
-               } else {
+               if (p_begin != pp) {
                        retval[pos] = _dl_malloc(pp - p_begin + 1);
                        if (retval[pos] == NULL)
                                goto badret;
@@ -68,7 +61,7 @@ _dl_split_path(const char *searchpath)
                        retval[pos++][pp - p_begin] = '\0';
                }
 
-               if (*pp)        /* Try curdir if ':' at end */
+               if (*pp)
                        pp++;
                else
                        pp = NULL;