summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-07-03 23:11:29 +0000
committerderaadt <deraadt@openbsd.org>2002-07-03 23:11:29 +0000
commitf0060bd71851caaa54d5fdd9844495a7e3b05753 (patch)
treeb6b6dd8ea7c689520b228e7cef61e3421d761f04
parentif localid is too long, abort; found by cloder@acm.org (diff)
downloadwireguard-openbsd-f0060bd71851caaa54d5fdd9844495a7e3b05753.tar.xz
wireguard-openbsd-f0060bd71851caaa54d5fdd9844495a7e3b05753.zip
missing or incorrect checks for malloc failure; cloder@acm.org
-rw-r--r--usr.sbin/dhcp/common/alloc.c2
-rw-r--r--usr.sbin/dhcp/sysconfd/sysconfd.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/dhcp/common/alloc.c b/usr.sbin/dhcp/common/alloc.c
index 38fe5e7536a..ad976a33d25 100644
--- a/usr.sbin/dhcp/common/alloc.c
+++ b/usr.sbin/dhcp/common/alloc.c
@@ -129,6 +129,8 @@ struct hash_table *new_hash_table(count, name)
rval = dmalloc(sizeof (struct hash_table)
- (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *))
+ (count * sizeof(struct hash_bucket *)), name);
+ if (rval == NULL)
+ return NULL;
rval->hash_count = count;
return rval;
}
diff --git a/usr.sbin/dhcp/sysconfd/sysconfd.c b/usr.sbin/dhcp/sysconfd/sysconfd.c
index 5598f7d5636..d978a0f5455 100644
--- a/usr.sbin/dhcp/sysconfd/sysconfd.c
+++ b/usr.sbin/dhcp/sysconfd/sysconfd.c
@@ -44,7 +44,7 @@
#ifndef lint
static char copyright[] =
-"$Id: sysconfd.c,v 1.3 2002/06/21 03:30:21 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: sysconfd.c,v 1.4 2002/07/03 23:11:29 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -140,7 +140,7 @@ void new_connection (proto)
int new_fd;
tmp = (struct sysconf_client *)malloc (sizeof *tmp);
- if (tmp < 0)
+ if (tmp == NULL)
error ("Can't find memory for new client!");
memset (tmp, 0, sizeof *tmp);