summaryrefslogtreecommitdiff
path: root/usr.sbin/mrinfo/mrinfo.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
commit6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch)
treebb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.sbin/mrinfo/mrinfo.c
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.sbin/mrinfo/mrinfo.c')
-rw-r--r--usr.sbin/mrinfo/mrinfo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c
index f2241f0c55c..376f0450502 100644
--- a/usr.sbin/mrinfo/mrinfo.c
+++ b/usr.sbin/mrinfo/mrinfo.c
@@ -76,7 +76,7 @@
#ifndef lint
static char rcsid[] =
- "@(#) $OpenBSD: mrinfo.c,v 1.21 2005/06/20 14:48:26 robert Exp $";
+ "@(#) $OpenBSD: mrinfo.c,v 1.22 2007/09/02 15:19:39 deraadt Exp $";
/* original rcsid:
"@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)";
*/
@@ -355,7 +355,7 @@ main(int argc, char *argv[])
if ((target_addr = inet_addr(host)) != -1) {
hp = &bogus;
hp->h_length = sizeof(target_addr);
- if (!(hp->h_addr_list = (char **)malloc(2 * sizeof(char *))))
+ if (!(hp->h_addr_list = (char **)calloc(2, sizeof(char *))))
err(1, "can't allocate memory");
if (!(hp->h_addr_list[0] = malloc(hp->h_length)))
err(1, "can't allocate memory");