summaryrefslogtreecommitdiff
path: root/libexec/ld.so/util.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/util.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/util.c')
-rw-r--r--libexec/ld.so/util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libexec/ld.so/util.c b/libexec/ld.so/util.c
index 627a5efc2f2..0b2b159cb52 100644
--- a/libexec/ld.so/util.c
+++ b/libexec/ld.so/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.31 2014/06/14 20:31:17 miod Exp $ */
+/* $OpenBSD: util.c,v 1.32 2014/06/21 08:00:23 otto Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -51,11 +51,12 @@ char *
_dl_strdup(const char *orig)
{
char *newstr;
- int len;
+ size_t len;
len = _dl_strlen(orig)+1;
newstr = _dl_malloc(len);
- _dl_strlcpy(newstr, orig, len);
+ if (newstr != NULL)
+ _dl_strlcpy(newstr, orig, len);
return (newstr);
}