summaryrefslogtreecommitdiff
path: root/libexec/ld.so/path.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2019-12-17 17:16:33 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2019-12-17 17:16:33 +0000
commit7c5615bbb5aa195cc362e91bc775696624773eda (patch)
tree9594ff032e4810f8db5d411a01162ed1c85f935c /libexec/ld.so/path.c
parent97d13050d69ef83782f9d90174f3e21a458e2e4f (diff)
Eliminate failure returns from _dl_split_path(): if malloc fails just _dl_oom()
Prompted by Qualys's leveraging malloc failure in _dl_split_path() to get stuff past. ok deraadt@ millert@
Diffstat (limited to 'libexec/ld.so/path.c')
-rw-r--r--libexec/ld.so/path.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libexec/ld.so/path.c b/libexec/ld.so/path.c
index f0dd706e3a9..657a1fdcd88 100644
--- a/libexec/ld.so/path.c
+++ b/libexec/ld.so/path.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: path.c,v 1.7 2017/06/22 20:44:36 benno Exp $ */
+/* $OpenBSD: path.c,v 1.8 2019/12/17 17:16:32 guenther Exp $ */
/*
* Copyright (c) 2013 Kurt Miller <kurt@intricatesoftware.com>
@@ -44,7 +44,7 @@ _dl_split_path(const char *searchpath)
retval = _dl_reallocarray(NULL, count, sizeof(*retval));
if (retval == NULL)
- return (NULL);
+ _dl_oom();
pp = searchpath;
while (pp) {
@@ -55,7 +55,7 @@ _dl_split_path(const char *searchpath)
if (p_begin != pp) {
retval[pos] = _dl_malloc(pp - p_begin + 1);
if (retval[pos] == NULL)
- goto badret;
+ _dl_oom();
_dl_bcopy(p_begin, retval[pos], pp - p_begin);
retval[pos++][pp - p_begin] = '\0';
@@ -69,10 +69,6 @@ _dl_split_path(const char *searchpath)
retval[pos] = NULL;
return (retval);
-
-badret:
- _dl_free_path(retval);
- return (NULL);
}
void