summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/setmode.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-09-02 15:19:07 +0000
committerderaadt <deraadt@openbsd.org>2007-09-02 15:19:07 +0000
commit1ed98fdf61d9dd29369f246109081408082ce54d (patch)
treead7631e58c83830d1fc51cbadb9a2da53c1abfb7 /lib/libc/gen/setmode.c
parentOpenCVS server init-support with OpenCVS and GNU cvs clients. (diff)
downloadwireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.tar.xz
wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.zip
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'lib/libc/gen/setmode.c')
-rw-r--r--lib/libc/gen/setmode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c
index 843b46183c9..9cc2cbc59ba 100644
--- a/lib/libc/gen/setmode.c
+++ b/lib/libc/gen/setmode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setmode.c,v 1.19 2006/03/12 18:36:46 otto Exp $ */
+/* $OpenBSD: setmode.c,v 1.20 2007/09/02 15:19:16 deraadt Exp $ */
/* $NetBSD: setmode.c,v 1.15 1997/02/07 22:21:06 christos Exp $ */
/*
@@ -187,7 +187,7 @@ setmode(const char *p)
setlen = SET_LEN + 2;
- if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
+ if ((set = calloc((u_int)sizeof(BITCMD), setlen)) == NULL)
return (NULL);
saveset = set;
endset = set + (setlen - 2);