diff options
author | 2015-08-20 22:16:35 +0000 | |
---|---|---|
committer | 2015-08-20 22:16:35 +0000 | |
commit | 89712eb620e16d9e8916a471f4e40ff3cec15a26 (patch) | |
tree | f0e7e153f8db0f1c84821874d1b7ad4053015e2f | |
parent | Do not cast a size_t to (unsigned long) to pass it as an argument to malloc. (diff) | |
download | wireguard-openbsd-89712eb620e16d9e8916a471f4e40ff3cec15a26.tar.xz wireguard-openbsd-89712eb620e16d9e8916a471f4e40ff3cec15a26.zip |
Two reallocarray() conversions that were missed earlier.
OK deraadt@
-rw-r--r-- | sbin/mountd/mountd.c | 4 | ||||
-rw-r--r-- | sbin/pdisk/dump.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 06e2b94bd0a..6ec1a89f8cd 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mountd.c,v 1.80 2015/08/20 22:02:21 deraadt Exp $ */ +/* $OpenBSD: mountd.c,v 1.81 2015/08/20 22:16:35 millert Exp $ */ /* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */ /* @@ -1466,7 +1466,7 @@ get_host(char *cp, struct grouplist *grp, struct grouplist *tgrp) i = 1; while (*addrp++) i++; - naddrp = nhp->h_addr_list = malloc(i*sizeof(char *)); + naddrp = nhp->h_addr_list = reallocarray(NULL, i, sizeof(char *)); if (naddrp == NULL) out_of_mem(); addrp = hp->h_addr_list; diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c index 935d01a03cd..b6bd3adb918 100644 --- a/sbin/pdisk/dump.c +++ b/sbin/pdisk/dump.c @@ -695,7 +695,7 @@ display_patches(partition_map *entry) if (p->numPatchBlocks != 1) { i = p->numPatchBlocks; free(patch_block); - patch_block = malloc(PBLOCK_SIZE*i); + patch_block = reallocarray(NULL, i, PBLOCK_SIZE); if (patch_block == NULL) { error(errno, "can't allocate memory for patch blocks buffer"); return; |