summaryrefslogtreecommitdiff
path: root/client/wallet.c
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-15 23:14:51 -0700
committerRuss Allbery <rra@stanford.edu>2014-07-15 23:15:34 -0700
commit89c22ebc4129f4abaf8dbb416b87ba423c1abe58 (patch)
tree5bc86145eef927d13483d38b77018e1b7e0668ff /client/wallet.c
parent5d0038202d82c71119fefa9c5bd0f816ae55991c (diff)
Use xcalloc instead of xmalloc with calculated sizes
Ensure we don't have integer overflow when allocating the array of struct iovec for store commands. Change-Id: I0777ca8ef050b9773dba0c03b5e8533d3b2d5486 Reviewed-on: https://gerrit.stanford.edu/1560 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'client/wallet.c')
-rw-r--r--client/wallet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/client/wallet.c b/client/wallet.c
index 09e9664..c3b039f 100644
--- a/client/wallet.c
+++ b/client/wallet.c
@@ -2,7 +2,7 @@
* The client program for the wallet system.
*
* Written by Russ Allbery <eagle@eyrie.org>
- * Copyright 2006, 2007, 2008, 2010
+ * Copyright 2006, 2007, 2008, 2010, 2014
* The Board of Trustees of the Leland Stanford Junior University
*
* See LICENSE for licensing terms.
@@ -181,7 +181,7 @@ main(int argc, char *argv[])
else if (argc < 4)
count++;
}
- command = xmalloc(sizeof(struct iovec) * count);
+ command = xcalloc(count, sizeof(struct iovec));
command[0].iov_base = (char *) options.type;
command[0].iov_len = strlen(options.type);
for (i = 0; i < argc; i++) {