summaryrefslogtreecommitdiff
path: root/libexec/spamd-setup
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 /libexec/spamd-setup
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'libexec/spamd-setup')
-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);
}