summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2014-10-11 03:05:48 +0000
committerdoug <doug@openbsd.org>2014-10-11 03:05:48 +0000
commit7b988c83be4b44598d7663cd4e933e3b51ed64ab (patch)
treed981645961f13f7f50879e01a6dd3fd3c7bdccc5 /usr.bin/indent
parentUserland reallocarray() audit. (diff)
downloadwireguard-openbsd-7b988c83be4b44598d7663cd4e933e3b51ed64ab.tar.xz
wireguard-openbsd-7b988c83be4b44598d7663cd4e933e3b51ed64ab.zip
Userland reallocarray() audit.
Avoid potential integer overflow in the size argument of malloc() and realloc() by using reallocarray() to avoid unchecked multiplication. ok deraadt@
Diffstat (limited to 'usr.bin/indent')
-rw-r--r--usr.bin/indent/lexi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c
index 3b3b5dd7bec..09a1bd26232 100644
--- a/usr.bin/indent/lexi.c
+++ b/usr.bin/indent/lexi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lexi.c,v 1.16 2013/11/26 13:21:17 deraadt Exp $ */
+/* $OpenBSD: lexi.c,v 1.17 2014/10/11 03:05:48 doug Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -584,7 +584,7 @@ addkey(char *key, int val)
int newspecials = maxspecials + (maxspecials >> 2);
struct templ *specials2;
- specials2 = realloc(specials, newspecials * sizeof specials[0]);
+ specials2 = reallocarray(specials, newspecials, sizeof(specials[0]));
if (specials2 == NULL)
err(1, NULL);
specials = specials2;