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

INN Commit rra at isc.org
Mon Sep 18 19:51:17 UTC 2017


    Date: Monday, September 18, 2017 @ 12:51:17
  Author: iulius
Revision: 10177

Avoid a zero-size vector allocation

Update to latest rra-c-util upstream version.

Modified:
  branches/2.6/configure.ac
  branches/2.6/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:50:45 UTC (rev 10176)
+++ configure.ac	2017-09-18 19:51:17 UTC (rev 10177)
@@ -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:50:45 UTC (rev 10176)
+++ lib/reallocarray.c	2017-09-18 19:51:17 UTC (rev 10177)
@@ -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