INN commit: trunk (lib/snprintf.c m4/cc-flags.m4 tests/tap/process.c)

INN Commit rra at isc.org
Sun Nov 6 14:01:42 UTC 2016


    Date: Sunday, November 6, 2016 @ 06:01:41
  Author: iulius
Revision: 10109

Update to latest upstream version of rra-c-util

Work around warning bug in older gcc with snprintf.

Properly handle signed overflow in run_child_function.

Correctly handle -Wno-* options in INN_PROG_CC_FLAG.  GCC and Clang
both don't produce fatal errors for unknown -Wno-* flags, so test the
corresponding positive -W flag instead when determining if they're
supported.

Modified:
  trunk/lib/snprintf.c
  trunk/m4/cc-flags.m4
  trunk/tests/tap/process.c

---------------------+
 lib/snprintf.c      |    2 +-
 m4/cc-flags.m4      |    4 +++-
 tests/tap/process.c |    6 ++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c	2016-11-06 13:57:15 UTC (rev 10108)
+++ lib/snprintf.c	2016-11-06 14:01:41 UTC (rev 10109)
@@ -182,7 +182,7 @@
   char *strvalue;
   int min;
   int max;
-  int state;
+  unsigned int state;
   int flags;
   int cflags;
   int total;

Modified: m4/cc-flags.m4
===================================================================
--- m4/cc-flags.m4	2016-11-06 13:57:15 UTC (rev 10108)
+++ m4/cc-flags.m4	2016-11-06 14:01:41 UTC (rev 10109)
@@ -34,7 +34,9 @@
  AC_MSG_CHECKING([if $CC supports $1])
  AC_CACHE_VAL([_INN_PROG_CC_FLAG_CACHE([$1])],
     [save_CFLAGS=$CFLAGS
-     CFLAGS="$CFLAGS $1"
+     AS_CASE([$1],
+        [-Wno-*], [CFLAGS="$CFLAGS `echo "$1" | sed 's/-Wno-/-W/'`"],
+        [*],      [CFLAGS="$CFLAGS $1"])
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [int foo = 0;])],
         [_INN_PROG_CC_FLAG_CACHE([$1])=yes],
         [_INN_PROG_CC_FLAG_CACHE([$1])=no])

Modified: tests/tap/process.c
===================================================================
--- tests/tap/process.c	2016-11-06 13:57:15 UTC (rev 10108)
+++ tests/tap/process.c	2016-11-06 14:01:41 UTC (rev 10109)
@@ -15,7 +15,7 @@
  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
  *
  * Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2002, 2004, 2005, 2013 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2002, 2004, 2005, 2013, 2016 Russ Allbery <eagle at eyrie.org>
  * Copyright 2009, 2010, 2011, 2013, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -137,6 +137,8 @@
         count = 0;
         do {
             ret = read(fds[0], buf + count, buflen - count - 1);
+            if (SSIZE_MAX - count <= ret)
+                bail("maximum output size exceeded in run_child_function");
             if (ret > 0)
                 count += ret;
             if (count >= buflen - 1) {
@@ -144,7 +146,7 @@
                 buf = brealloc(buf, buflen);
             }
         } while (ret > 0);
-        buf[count < 0 ? 0 : count] = '\0';
+        buf[count] = '\0';
         if (waitpid(child, &rval, 0) == (pid_t) -1)
             sysbail("waitpid failed");
         close(fds[0]);



More information about the inn-committers mailing list