Re: yet another snprintf bug

2007-05-01 Thread Bruno Haible
Eric Blake wrote: > For strings larger than 1024 bytes, there was a > separate bug, where the NUL byte would be appended with a buffer overflow Is it possible to detect this with an autoconf test? Or not, because the buffer overflow will always hit memory that was not provided by the caller? Brun

Re: yet another snprintf bug

2007-04-29 Thread Eric Blake
-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, thi

yet another snprintf bug

2007-04-29 Thread Bruno Haible
[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. 2007-04-29 Bruno Haible <[EM