diff options
author | 2007-09-02 15:19:07 +0000 | |
---|---|---|
committer | 2007-09-02 15:19:07 +0000 | |
commit | 1ed98fdf61d9dd29369f246109081408082ce54d (patch) | |
tree | ad7631e58c83830d1fc51cbadb9a2da53c1abfb7 /sbin/raidctl/raidctl.c | |
parent | OpenCVS server init-support with OpenCVS and GNU cvs clients. (diff) | |
download | wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.tar.xz wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.zip |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'sbin/raidctl/raidctl.c')
-rw-r--r-- | sbin/raidctl/raidctl.c | 6 |
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) { |