diff options
author | Michael McConville <mmcco@mykolab.com> | 2015-12-11 23:04:36 -0500 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2015-12-12 15:25:40 -0500 |
commit | 77e54b25ee67ff066d8619d790b43cb2da227ae6 (patch) | |
tree | dd4f5be2eafbb738d731193c76c94d6509af9c90 /configure.ac | |
parent | 13b5b214f53d1c3354a7ab910bd160c126df1331 (diff) |
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.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 7 |
1 files changed, 6 insertions, 1 deletions
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 |