From 49c3d8e7c9d7c658f3a959f2900d68c528693dd6 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 8 Oct 2014 04:36:24 +0000 Subject: reallocarray() for mult int overflow detect; ok doug --- lib/libc/gen/fts.c | 6 +++--- 1 file 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; -- cgit v1.2.3