summaryrefslogtreecommitdiff
path: root/libexec/ld.so/path.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2014-06-21 08:00:24 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2014-06-21 08:00:24 +0000
commit029bd623b840ee0c0ca16b03d9a1ee177cdd31e9 (patch)
treeadcd53bff97a1881f29c5f29d7f1fe74acce03b8 /libexec/ld.so/path.c
parentd03a8d539ef55e2af53ca76005a541a0b2fdd808 (diff)
Move to a non-zeroing _dl_malloc, a _dl_calloc and _dl_reallocarry and
fix _dl_strdup to return NULL instead of crash; ok deraadt@
Diffstat (limited to 'libexec/ld.so/path.c')
-rw-r--r--libexec/ld.so/path.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/ld.so/path.c b/libexec/ld.so/path.c
index 5cc98ae25bc..239b6e86f06 100644
--- a/libexec/ld.so/path.c
+++ b/libexec/ld.so/path.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: path.c,v 1.1 2013/03/20 21:49:59 kurt Exp $ */
+/* $OpenBSD: path.c,v 1.2 2014/06/21 08:00:23 otto Exp $ */
/*
* Copyright (c) 2013 Kurt Miller <kurt@intricatesoftware.com>
@@ -43,7 +43,7 @@ _dl_split_path(const char *searchpath)
/* one more for NULL entry */
count++;
- retval = _dl_malloc(count * sizeof(retval));
+ retval = _dl_reallocarray(NULL, count, sizeof(retval));
if (retval == NULL)
return (NULL);
@@ -76,6 +76,7 @@ _dl_split_path(const char *searchpath)
pp = NULL;
}
+ retval[pos] = NULL;
return (retval);
badret: