On Wed, 12 Feb 2003, Stefan Esser wrote: > On Wed, Feb 12, 2003 at 08:13:49AM +0900, Moriyoshi Koizumi wrote: > > some clarification here so I can find snprintf related bugs elsewhere. > > As long as snprintf must not truncate it will return the number of > written bytes (excluding '\0'). If sprintf must truncate it either > returns -1 or (if it is C99 compatible) the number of bytes that > would have been written if there would be enough space.
And that's the problem. snprintf usage should always look similar to this: snprintf(buf, sizeof(buf), fmt, ...); buf[sizeof(buf)-1] = '\0'; - Sascha -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php