summaryrefslogtreecommitdiffstats
path: root/usr.bin/sup/src/scm.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 /usr.bin/sup/src/scm.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 'usr.bin/sup/src/scm.c')
-rw-r--r--usr.bin/sup/src/scm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/sup/src/scm.c b/usr.bin/sup/src/scm.c
index f6fad5cade4..7093440863a 100644
--- a/usr.bin/sup/src/scm.c
+++ b/usr.bin/sup/src/scm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scm.c,v 1.18 2005/03/10 01:36:37 cloder Exp $ */
+/* $OpenBSD: scm.c,v 1.19 2007/09/02 15:19:35 deraadt Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@@ -576,7 +576,7 @@ samehost() /* is remote host same as local host? */
if ((nint = ifc.ifc_len / sizeof(struct ifreq)) <= 0)
return (0);
intp = (struct in_addr *)
- malloc (nint * sizeof(struct in_addr));
+ calloc (nint, sizeof(struct in_addr));
if ((ifp = intp) == 0)
logquit (1, "no space for interfaces");
for (ifr = ifc.ifc_req, n = nint; n > 0; --n, ifr++) {