summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2014-10-08 04:04:37 +0000
committerdoug <doug@openbsd.org>2014-10-08 04:04:37 +0000
commit29d198a09e6d9a8ba602143838cd2ac4cbba66be (patch)
tree8d64b6a942b182fdfe02e59a23549825830ee50c
parentuserland reallocarray audit. (diff)
downloadwireguard-openbsd-29d198a09e6d9a8ba602143838cd2ac4cbba66be.tar.xz
wireguard-openbsd-29d198a09e6d9a8ba602143838cd2ac4cbba66be.zip
userland reallocarray audit.
Replace malloc() and realloc() calls that may have integer overflow in the multiplication of the size argument with reallocarray(). ok deraadt@
-rw-r--r--usr.bin/locate/locate/util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index be8809da98e..2643ed10c32 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.10 2007/09/02 15:19:33 deraadt Exp $
+/* $OpenBSD: util.c,v 1.11 2014/10/08 04:04:37 doug Exp $
*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* Copyright (c) 1989, 1993
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: util.c,v 1.10 2007/09/02 15:19:33 deraadt Exp $
+ * $Id: util.c,v 1.11 2014/10/08 04:04:37 doug Exp $
*/
@@ -122,8 +122,8 @@ colon(dbv, path, dot)
*(p + slen) = '\0';
}
/* increase dbv with element p */
- if ((newdbv = realloc(dbv, sizeof(char **) * (vlen + 2)))
- == NULL)
+ if ((newdbv = reallocarray(dbv, vlen + 2,
+ sizeof(char **))) == NULL)
err(1, "realloc");
dbv = newdbv;
*(dbv + vlen) = p;