INN commit: branches/2.6 (3 files)

INN Commit rra at isc.org
Sun Nov 6 14:20:36 UTC 2016


    Date: Sunday, November 6, 2016 @ 06:20:36
  Author: iulius
Revision: 10115

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:
  branches/2.6/lib/snprintf.c
  branches/2.6/m4/cc-flags.m4
  branches/2.6/tests/tap/process.c

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

Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c	2016-11-06 14:18:27 UTC (rev 10114)
+++ lib/snprintf.c	2016-11-06 14:20:36 UTC (rev 10115)
@@ -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 14:18:27 UTC (rev 10114)
+++ m4/cc-flags.m4	2016-11-06 14:20:36 UTC (rev 10115)
@@ -6,7 +6,7 @@
 dnl not, the commands in the third argument are run.
 dnl
 dnl The canonical version of this file is maintained in the rra-c-util
-dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
 dnl
 dnl Copyright 2016 Russ Allbery <eagle at eyrie.org>
 dnl Copyright 2006, 2009, 2016
@@ -26,7 +26,7 @@
 
 dnl Used to build the result cache name.
 AC_DEFUN([_INN_PROG_CC_FLAG_CACHE],
-[translit([inn_cv_compiler_c_$1], [-], [_])])
+[translit([inn_cv_compiler_c_$1], [-=], [__])])
 
 dnl Check whether a given flag is supported by the complier.
 AC_DEFUN([INN_PROG_CC_FLAG],
@@ -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 14:18:27 UTC (rev 10114)
+++ tests/tap/process.c	2016-11-06 14:20:36 UTC (rev 10115)
@@ -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