From 77e54b25ee67ff066d8619d790b43cb2da227ae6 Mon Sep 17 00:00:00 2001 From: Michael McConville Date: Fri, 11 Dec 2015 23:04:36 -0500 Subject: Added new function reallocarray. This is taken from OpenSSH Portable, which in turn takes it from OpenBSD. reallocarray wraps the stdlib's realloc function. It takes two size arguments and checks for overflow, like calloc, but doesn't zero the memory. Therefore, it allows us to do overflow-safe array reallocations and overflow-safe unzeroed array allocations, which the stdlib allocation functions don't. We have a bunch of specific array allocation macros, none of which check for overflow. reallocarray should be able to replace them. --- configure.ac | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index f60203f..4350f9d 100644 --- a/configure.ac +++ b/configure.ac @@ -125,7 +125,12 @@ AC_FUNC_ALLOCA AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_REALLOC -AC_CHECK_FUNCS([dup2 memset pow regcomp setlocale strchr strdup strtol]) + +AC_CHECK_FUNCS([dup2 memset pow reallocarray regcomp setlocale strchr strdup strtol]) + +if [ "$ac_cv_func_reallocarray" = "no" ] ; then + AC_LIBOBJ([reallocarray]) +fi AC_CONFIG_FILES( Makefile -- cgit v1.2.3