summaryrefslogtreecommitdiff
path: root/usr.bin/locate
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-10-08 04:04:38 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-10-08 04:04:38 +0000
commitbc5038f9a5986d5bf1b73b523c37fc2306941aca (patch)
tree850872af4a1105dd3a9b62984098b5831f40a425 /usr.bin/locate
parent5bb938e812205cce167f4b1bb9cae332ecb87820 (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/locate')
-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;