summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-07-30 22:39:35 +0000
committerderaadt <deraadt@openbsd.org>2002-07-30 22:39:35 +0000
commitec9137dd86e17277a321133df89c8268b6517118 (patch)
treedd07e327d7d3f50e5573dd57431159d8a1d9b866
parentsome snprintf and strlcpy (diff)
downloadwireguard-openbsd-ec9137dd86e17277a321133df89c8268b6517118.tar.xz
wireguard-openbsd-ec9137dd86e17277a321133df89c8268b6517118.zip
for the disabled DSTORAGE option, fix the local calloc() here in the same way as libc; eugene@securityarchitects.com
-rw-r--r--usr.sbin/named/named/storage.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/named/named/storage.c b/usr.sbin/named/named/storage.c
index 0fda2ac6a9c..b71f8a41966 100644
--- a/usr.sbin/named/named/storage.c
+++ b/usr.sbin/named/named/storage.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: storage.c,v 1.5 2002/06/09 01:58:54 kjell Exp $ */
+/* $OpenBSD: storage.c,v 1.6 2002/07/30 22:39:35 deraadt Exp $ */
/*
* ++Copyright++ 1985, 1989
@@ -58,6 +58,8 @@
#include <sys/types.h>
#include <sys/param.h>
#include <syslog.h>
+#include <limits.h>
+#include <errno.h>
#include "../conf/portability.h"
#include "../conf/options.h"
@@ -190,6 +192,10 @@ calloc(num, size)
{
register char *p;
+ if (SIZE_T_MAX / num < size) {
+ errno = ENOMEM;
+ return NULL;
+ }
size *= num;
if (p = rt_malloc(size))
bzero(p, size);