summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-10-08 04:36:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-10-08 04:36:24 +0000
commit49c3d8e7c9d7c658f3a959f2900d68c528693dd6 (patch)
treedcf9dcc59ddb15a35139b5491348fde8fb66a462
parent6ada7ebbc61eaa94efa44cc8ecacf740a5a25e32 (diff)
reallocarray() for mult int overflow detect; ok doug
-rw-r--r--lib/libc/gen/fts.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 8d845436ea8..7af5d4a2382 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.46 2014/05/25 17:47:04 tedu Exp $ */
+/* $OpenBSD: fts.c,v 1.47 2014/10/08 04:36:23 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -870,8 +870,8 @@ fts_sort(FTS *sp, FTSENT *head, int nitems)
struct _ftsent **a;
sp->fts_nitems = nitems + 40;
- if ((a = realloc(sp->fts_array,
- sp->fts_nitems * sizeof(FTSENT *))) == NULL) {
+ if ((a = reallocarray(sp->fts_array,
+ sp->fts_nitems, sizeof(FTSENT *))) == NULL) {
if (sp->fts_array)
free(sp->fts_array);
sp->fts_array = NULL;