From 9e509d4ec97cb3d71696f1a2f1fdad254cbbce11 Mon Sep 17 00:00:00 2001 From: "deraadt@openbsd.org" Date: Wed, 31 May 2017 09:15:42 +0000 Subject: upstream commit Switch to recallocarray() for a few operations. Both growth and shrinkage are handled safely, and there also is no need for preallocation dances. Future changes in this area will be less error prone. Review and one bug found by markus Upstream-ID: 822d664d6a5a1d10eccb23acdd53578a679d5065 --- misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index cfd32729a..af24fa5c4 100644 --- a/misc.c +++ b/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.109 2017/03/14 00:55:37 dtucker Exp $ */ +/* $OpenBSD: misc.c,v 1.110 2017/05/31 09:15:42 deraadt Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005,2006 Damien Miller. All rights reserved. @@ -539,7 +539,7 @@ addargs(arglist *args, char *fmt, ...) } else if (args->num+2 >= nalloc) nalloc *= 2; - args->list = xreallocarray(args->list, nalloc, sizeof(char *)); + args->list = xrecallocarray(args->list, args->nalloc, nalloc, sizeof(char *)); args->nalloc = nalloc; args->list[args->num++] = cp; args->list[args->num] = NULL; -- cgit v1.2.3