summaryrefslogtreecommitdiffstats
path: root/libexec/spamd-setup/spamd-setup.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 /libexec/spamd-setup/spamd-setup.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 'libexec/spamd-setup/spamd-setup.c')
-rw-r--r--libexec/spamd-setup/spamd-setup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c
index 4efcbc5f223..51041a50816 100644
--- a/libexec/spamd-setup/spamd-setup.c
+++ b/libexec/spamd-setup/spamd-setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd-setup.c,v 1.32 2007/02/27 02:10:58 beck Exp $ */
+/* $OpenBSD: spamd-setup.c,v 1.33 2007/09/02 15:19:20 deraadt Exp $ */
/*
* Copyright (c) 2003 Bob Beck. All rights reserved.
@@ -311,7 +311,7 @@ open_file(char *method, char *file)
return (i);
} else if (strcmp(method, "exec") == 0) {
len = strlen(file);
- argv = malloc(len * sizeof(char *));
+ argv = calloc(len, sizeof(char *));
if (argv == NULL)
errx(1, "malloc failed");
for (ap = argv; ap < &argv[len - 1] &&
@@ -540,7 +540,7 @@ collapse_blacklist(struct bl *bl, size_t blc)
if (blc == 0)
return (NULL);
- cl = malloc(((blc / 2) + 1) * sizeof(struct cidr));
+ cl = calloc(((blc / 2) + 1), sizeof(struct cidr));
if (cl == NULL) {
return (NULL);
}