summaryrefslogtreecommitdiff
path: root/usr.bin/systat/cache.c
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-10-08 04:11:29 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-10-08 04:11:29 +0000
commit9be39b80d61237e184b8aca283cfd3a7afa5efd3 (patch)
tree15ed7fdd6c9ae9ad13e0794f5767b4bcb5b9d99b /usr.bin/systat/cache.c
parent943bd3702ccb622601eb6c5fdd3439b2fba96595 (diff)
userland reallocarray audit.
Replace malloc() and realloc() calls that may have integer overflow in the multiplication of the size argument with reallocarray(). ok deraadt@
Diffstat (limited to 'usr.bin/systat/cache.c')
-rw-r--r--usr.bin/systat/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/systat/cache.c b/usr.bin/systat/cache.c
index 5c9a2a89d6f..7f55e645a79 100644
--- a/usr.bin/systat/cache.c
+++ b/usr.bin/systat/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.4 2011/11/29 10:17:52 dlg Exp $ */
+/* $Id: cache.c,v 1.5 2014/10/08 04:10:04 doug Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar <canacar@openbsd.org>
*
@@ -68,7 +68,7 @@ cache_init(int max)
if (max == 0) {
sc_store = NULL;
} else {
- sc_store = malloc(max * sizeof(struct sc_ent));
+ sc_store = reallocarray(NULL, max, sizeof(struct sc_ent));
if (sc_store == NULL)
return (1);
}