summaryrefslogtreecommitdiff
path: root/sbin/raidctl
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 /sbin/raidctl
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'sbin/raidctl')
-rw-r--r--sbin/raidctl/raidctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/raidctl/raidctl.c b/sbin/raidctl/raidctl.c
index 2f46e630009..6b2ce6aa782 100644
--- a/sbin/raidctl/raidctl.c
+++ b/sbin/raidctl/raidctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raidctl.c,v 1.27 2007/02/21 16:33:09 jmc Exp $ */
+/* $OpenBSD: raidctl.c,v 1.28 2007/09/02 15:19:24 deraadt Exp $ */
/* $NetBSD: raidctl.c,v 1.27 2001/07/10 01:30:52 lukem Exp $ */
/*-
@@ -1159,7 +1159,7 @@ open_device(fdidpair **devfd, char *name)
}
}
- if ((*devfd = malloc(nfd * sizeof(fdidpair))) == NULL)
+ if ((*devfd = calloc(nfd, sizeof(fdidpair))) == NULL)
errx(1, "malloc() error");
i = nfd;
@@ -1205,7 +1205,7 @@ get_all_devices(char ***diskarray, const char *genericname)
fp++;
}
- *diskarray = (char**) malloc(numdevs * sizeof(void*));
+ *diskarray = (char**) calloc(numdevs, sizeof(void*));
i = 0;
fp = disks;
while ((p = strsep(&fp, ",")) != NULL) {