From: benno Date: Thu, 22 Jun 2017 20:44:36 +0000 (+0000) Subject: Do not interpret an empty path as current working directory "." when X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6f60d148b3e231ec6045b9e923a38464ce52e8e8;p=openbsd Do not interpret an empty path as current working directory "." when parsing LD_LIBRARY_PATH, and in DT_RPATH and DT_RUNPATH attributes and in ld.so.hints. ok deraadt@ --- diff --git a/libexec/ld.so/path.c b/libexec/ld.so/path.c index 34a52dbb5a2..f0dd706e3a9 100644 --- a/libexec/ld.so/path.c +++ b/libexec/ld.so/path.c @@ -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 @@ -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;