INN commit: trunk (configure.ac lib/reallocarray.c)

INN Commit rra at isc.org
Mon Sep 18 19:50:45 UTC 2017


    Date: Monday, September 18, 2017 @ 12:50:45
  Author: iulius
Revision: 10176

Avoid a zero-size vector allocation

Update to latest rra-c-util upstream version.

Modified:
  trunk/configure.ac
  trunk/lib/reallocarray.c

--------------------+
 configure.ac       |    2 +-
 lib/reallocarray.c |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Modified: configure.ac
===================================================================
--- configure.ac	2017-09-18 19:48:24 UTC (rev 10175)
+++ configure.ac	2017-09-18 19:50:45 UTC (rev 10176)
@@ -529,7 +529,7 @@
 
 dnl Generic checks for header files.
 AC_CHECK_HEADERS([crypt.h inttypes.h limits.h \
-                  stdint.h sys/bitypes.h sys/filio.h sys/loadavg.h \
+                  stdint.h strings.h sys/bitypes.h sys/filio.h sys/loadavg.h \
                   sys/select.h sys/time.h sys/uio.h syslog.h unistd.h])
 
 dnl Some Linux systems have db1/ndbm.h instead of ndbm.h.  Others have

Modified: lib/reallocarray.c
===================================================================
--- lib/reallocarray.c	2017-09-18 19:48:24 UTC (rev 10175)
+++ lib/reallocarray.c	2017-09-18 19:50:45 UTC (rev 10176)
@@ -53,5 +53,11 @@
             errno = ENOMEM;
             return NULL;
         }
+
+    /* Avoid a zero-size allocation. */
+    if (nmemb == 0 || size == 0) {
+        nmemb = 1;
+        size = 1;
+    }
     return realloc(ptr, nmemb * size);
 }



More information about the inn-committers mailing list