summaryrefslogtreecommitdiff
path: root/usr.bin/users
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/users
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/users')
-rw-r--r--usr.bin/users/users.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/users/users.c b/usr.bin/users/users.c
index 206af35e1db..f10e336d023 100644
--- a/usr.bin/users/users.c
+++ b/usr.bin/users/users.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: users.c,v 1.10 2013/11/15 22:20:04 millert Exp $ */
+/* $OpenBSD: users.c,v 1.11 2014/10/08 04:11:28 doug Exp $ */
/* $NetBSD: users.c,v 1.5 1994/12/20 15:58:19 jtc Exp $ */
/*
@@ -74,8 +74,8 @@ main(int argc, char *argv[])
size_t newmax = nmax + 32;
namebuf *newnames;
- newnames = realloc(names,
- sizeof(*names) * newmax);
+ newnames = reallocarray(names, newmax,
+ sizeof(*names));
if (newnames == NULL) {
err(1, NULL);