summaryrefslogtreecommitdiff
path: root/usr.sbin/cron/env.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/cron/env.c
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.sbin/cron/env.c')
-rw-r--r--usr.sbin/cron/env.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/cron/env.c b/usr.sbin/cron/env.c
index aacce1d9ccc..018f2841f46 100644
--- a/usr.sbin/cron/env.c
+++ b/usr.sbin/cron/env.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: env.c,v 1.18 2005/01/30 20:44:50 millert Exp $ */
+/* $OpenBSD: env.c,v 1.19 2007/09/02 15:19:38 deraadt Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -22,7 +22,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char const rcsid[] = "$OpenBSD: env.c,v 1.18 2005/01/30 20:44:50 millert Exp $";
+static char const rcsid[] = "$OpenBSD: env.c,v 1.19 2007/09/02 15:19:38 deraadt Exp $";
#endif
#include "cron.h"
@@ -52,7 +52,7 @@ env_copy(char **envp) {
for (count = 0; envp[count] != NULL; count++)
continue;
- p = (char **) malloc((count+1) * sizeof(char *)); /* 1 for the NULL */
+ p = (char **) calloc(count+1, sizeof(char *)); /* 1 for the NULL */
if (p != NULL) {
for (i = 0; i < count; i++)
if ((p[i] = strdup(envp[i])) == NULL) {