diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-06-22 20:44:37 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2017-06-22 20:44:37 +0000 |
commit | eb9817257d1fabe20c064358fe6e5de4a2030ccc (patch) | |
tree | 5d0a03b5b073aedce87ca0db95701743a5b57c66 /libexec/ld.so | |
parent | 5314bca500e770208a697c5dd587bbfdad7b419e (diff) |
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@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/path.c | 13 |
1 files changed, 3 insertions, 10 deletions
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 <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; |