From 6ebd04219f0d749c87a763e8afb578dfcd5223cc Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 2 Sep 2007 15:19:41 +0000 Subject: use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg --- usr.sbin/lpr/pac/pac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin/lpr/pac/pac.c') diff --git a/usr.sbin/lpr/pac/pac.c b/usr.sbin/lpr/pac/pac.c index 60d9d237f34..894699eef0b 100644 --- a/usr.sbin/lpr/pac/pac.c +++ b/usr.sbin/lpr/pac/pac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pac.c,v 1.17 2003/06/02 23:36:53 millert Exp $ */ +/* $OpenBSD: pac.c,v 1.18 2007/09/02 15:19:39 deraadt Exp $ */ /* $NetBSD: pac.c,v 1.14 2000/04/27 13:40:18 msaitoh Exp $ */ /* @@ -41,7 +41,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)pac.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: pac.c,v 1.17 2003/06/02 23:36:53 millert Exp $"; +static const char rcsid[] = "$OpenBSD: pac.c,v 1.18 2007/09/02 15:19:39 deraadt Exp $"; #endif #endif /* not lint */ @@ -286,7 +286,7 @@ dumpit(void) hp = hashtab[0]; hno = 1; - base = (struct hent **) malloc(hcount * sizeof(hp)); + base = (struct hent **) calloc(hcount, sizeof(hp)); if (base == NULL) err(1, NULL); for (ap = base, c = hcount; c--; ap++) { -- cgit v1.2.3