On Thu, 21 Aug 2014, Tom Christensen wrote: > On 21/08/14 03:00, Damien Miller wrote: > > Thanks for figuring this out. I'd prefer to keep the dependencies from > > the tests to a minimum, at least until we have the API defined in > > libopenssh, so here's a workaround that uses argv[0]: > > > <snip patch> > > That took care of the segfault but unfortunately test_sshbuf fails: > test_sshbuf: ........................................................ > regress/unittests/sshbuf/test_sshbuf_getput_basic.c:412 test #57 "sshbuf_putf" > ASSERT_INT_EQ(r, 0) failed: > r = -10 > 0 = 0 > > The rest of the testsuite is a total loss presumably due to this early > failure. > > This is on Solaris 9/SPARC with gcc 4.9.1. It looks like this is failing: if ((len = vsnprintf(NULL, 0, fmt, ap2)) < 0) { Does your libc vsnprintf() support checking the length of the formatted string this way? (AFAIK SUSv3 requires it). We should check for it in configure anyway... Index: configure.ac =================================================================== RCS file: /var/cvs/openssh/configure.ac,v retrieving revision 1.580 diff -u -p -r1.580 configure.ac --- configure.ac 22 Aug 2014 07:36:20 -0000 1.580 +++ configure.ac 22 Aug 2014 07:48:42 -0000 @@ -1887,11 +1887,9 @@ if test "x$ac_cv_func_snprintf" = "xyes" ) 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 <stdio.h> #include <stdarg.h> -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])], [ _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@xxxxxxxxxxx https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev