This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 1.1.2: snprintf writes one too many characters


On Fri, Aug 11, 2000 at 09:22:49AM -0700, Eric Hanchrow wrote:
>In http://sources.redhat.com/ml/cygwin/2000-08/msg00276.html Doug and cgf
>write:
>    ...
>
>    >on Linux and HP-UX, when the string exceeds 'size' then (size - 1)
>    >chars plus a NUL are written, but on Cygwin 'size' chars are written
>    >and a NUL is placed into target[size]
>
>    It sounds like a bug to me.
>
>And it sounds like a bug to the GNU Configure script (at least, the
>version that comes with
>ftp://download.sourceforge.net/pub/mirrors/OpenBSD/OpenSSH/portable/openssh-
>2.1.1p4.tar.gz).
>That script reproduces the problem with this little C program:
>
>    #include <stdio.h>
>    int main(void)
>    {
>      char b[5];
>      snprintf(b,5,"123456789");
>      return(b[4]!='\0');
>    }
>
>The correct return value is 0, but on Cygwin, we get non-zero.
>
>This problem prevents me from building openssh.

This has already been noted.

The problem is fixed in the newlib CVS repository.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]