summaryrefslogtreecommitdiff
path: root/usr.bin/tput
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/tput
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/tput')
-rw-r--r--usr.bin/tput/tput.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c
index 9470469db0f..84bafe6e787 100644
--- a/usr.bin/tput/tput.c
+++ b/usr.bin/tput/tput.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tput.c,v 1.19 2013/11/27 15:23:01 yasuoka Exp $ */
+/* $OpenBSD: tput.c,v 1.20 2014/10/08 04:10:47 doug Exp $ */
/*
* Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -126,7 +126,8 @@ main(int argc, char *argv[])
/* grow av as needed */
if (argc + 1 >= n) {
n += 64;
- av = (char **)realloc(av, sizeof(char *) * n);
+ av = reallocarray(av, n,
+ sizeof(char *));
if (av == NULL)
errx(1, "out of memory");
}