From d244a5816fd1312a33404b436e4dd83594f1119e Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sat, 23 Aug 2014 17:06:49 +1000 Subject: [PATCH] - (djm) [configure.ac] We now require a working vsnprintf everywhere (not just for systems that lack asprintf); check for it always and extend test to catch more brokenness. Fixes builds on Solaris <= 9 --- ChangeLog | 3 +++ configure.ac | 30 ++++++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9478859ad..7a80c2a65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 20140823 - (djm) [sshd.c] Ignore SIGXFSZ in preauth monitor child; can explode on lastlog writing on platforms with high UIDs; bz#2263 + - (djm) [configure.ac] We now require a working vsnprintf everywhere (not + just for systems that lack asprintf); check for it always and extend + test to catch more brokenness. Fixes builds on Solaris <= 9 20140822 - (djm) [configure.ac] include leading zero characters in OpenSSL version diff --git a/configure.ac b/configure.ac index d93cc6b49..d5b4377b9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.581 2014/08/22 08:06:21 djm Exp $ +# $Id: configure.ac,v 1.582 2014/08/23 07:06:49 djm Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) -AC_REVISION($Revision: 1.581 $) +AC_REVISION($Revision: 1.582 $) AC_CONFIG_SRCDIR([ssh.c]) AC_LANG([C]) @@ -1887,11 +1887,9 @@ if test "x$ac_cv_func_snprintf" = "xyes" ; then ) fi -# If we don't have a working asprintf, then we strongly depend on vsnprintf -# returning the right thing on overflow: the number of characters it tried to -# create (as per SUSv3) -if test "x$ac_cv_func_asprintf" != "xyes" && \ - test "x$ac_cv_func_vsnprintf" = "xyes" ; then +# We depend on vsnprintf returning the right thing on overflow: the +# number of characters it tried to create (as per SUSv3) +if test "x$ac_cv_func_vsnprintf" = "xyes" ; then AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ @@ -1899,15 +1897,23 @@ if test "x$ac_cv_func_asprintf" != "xyes" && \ #include #include -int x_snprintf(char *str,size_t count,const char *fmt,...) +int x_snprintf(char *str, size_t count, const char *fmt, ...) { - size_t ret; va_list ap; - va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap); + size_t ret; + va_list ap; + + va_start(ap, fmt); + ret = vsnprintf(str, count, fmt, ap); + va_end(ap); return ret; } ]], [[ - char x[1]; - exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1); +char x[1]; +if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11) + return 1; +if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11) + return 1; +return 0; ]])], [AC_MSG_RESULT([yes])], [