summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-10-11 03:01:59 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-10-11 03:01:59 +0000
commit7057b4f3db1ae80d30b72fde60d1ef7329736315 (patch)
treeed2c6cc53d77fb185840179451aef048c25fd43e
parent92b0729983b8dbba641b2c8ad571493056bc0bd1 (diff)
Userland reallocarray() audit.
Avoid potential integer overflow in the size argument of malloc() and realloc() by using reallocarray() to avoid unchecked multiplication. ok deraadt@ (had same diff in tree)
-rw-r--r--usr.sbin/lpr/lpd/lpd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index 296f794d5f0..badc565111c 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.54 2014/07/12 02:56:01 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.55 2014/10/11 03:01:58 doug Exp $ */
/* $NetBSD: lpd.c,v 1.33 2002/01/21 14:42:29 wiz Exp $ */
/*
@@ -777,7 +777,7 @@ socksetup(int af, int options, const char *port)
if (socks)
*socks = 0; /* num of sockets ctr at start */
} else {
- newsocks = realloc(socks, (maxs + 1) * sizeof(int));
+ newsocks = reallocarray(socks, maxs + 1, sizeof(int));
if (newsocks)
socks = newsocks;
else {