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.bin/bdes/bdes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/bdes') diff --git a/usr.bin/bdes/bdes.c b/usr.bin/bdes/bdes.c index fdbb422f8bc..768fc508a15 100644 --- a/usr.bin/bdes/bdes.c +++ b/usr.bin/bdes/bdes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bdes.c,v 1.14 2004/05/16 18:49:12 otto Exp $ */ +/* $OpenBSD: bdes.c,v 1.15 2007/09/02 15:19:31 deraadt Exp $ */ /* $NetBSD: bdes.c,v 1.2 1995/03/26 03:33:19 glass Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)bdes.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: bdes.c,v 1.14 2004/05/16 18:49:12 otto Exp $"; +static char rcsid[] = "$OpenBSD: bdes.c,v 1.15 2007/09/02 15:19:31 deraadt Exp $"; #endif #endif /* not lint */ @@ -200,7 +200,7 @@ main(int ac, char *av[]) */ argc = ac; ac = 1; - argv = malloc((argc + 1) * sizeof(char *)); + argv = calloc(argc + 1, sizeof(char *)); if (argv == NULL) errx(1, "out of memory"); for (i = 0; i < argc; ++i) { -- cgit v1.2.3