-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruno Haible on 4/29/2007 9:46 AM: > [v]snprintf (buf, 0, format, ...) is expected to write nothing into 'buf' > according to C99 and POSIX. On Tru64, this nevertheless writes one NUL byte. > And on HP-UX 11.00...11.23, with vsnprintf, this even overwrites as much of > 'buf' as it can... This works around it. > > + dnl 10 = checking whether vsnprintf respects a zero size as in C99... > ! dnl Cygwin 2007 . # # . . . . . . ? > ! dnl Cygwin 2006 # # # . . . . . . ?
For small strings (including length 0), snprintf has worked correctly on cygwin since Aug 2000. For strings larger than 1024 bytes, there was a separate bug, where the NUL byte would be appended with a buffer overflow, this was buggy up until my patch in Nov 2006 (so it is broken on cygwin 1.5.19, which you are calling cygwin 2006, but fixed in 1.5.24, which you are calling cygwin 2007). In fact, it was a change in autoconf switching from here-docs to printf that detected this brokenness of older cygwin snprintf: http://lists.gnu.org/archive/html/autoconf-patches/2006-11/msg00067.html - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGNUpU84KuGfSFAYARAlzmAJ9OLtDP5L0CNO6jOwFnCsms6G4N4gCfQLnP miyikzXYOUUSADhjvbQsiLk= =KU+v -----END PGP SIGNATURE-----