[Zlib-devel] zlib version 1.2.3.8 available for testing

Mark Adler madler at alumni.caltech.edu
Mon Feb 15 02:16:42 EST 2010


On Feb 14, 2010, at 10:52 PM, Philip Lowman wrote:
> Since the code is calling snprintf() explicitly that's why it's failing.

Philip,

gzwrite.c will not call or even try to link snprintf() if WIN32 or _WIN32 or __WIN32__ is defined.  It uses vsnprintf() in that case.

The logic in zconf.h is that if _WIN32 or __WIN32__ are defined, then WIN32 is defined if it isn't already.  If WIN32 is defined, then STDC is defined if it isn't already.  In gzwrite.c, if STDC is defined, then the gzprintf() function will use vsnprintf(), unless NO_vsnprintf is defined, in which case it uses vsprintf().  Either way, it doesn't use snprintf().

Your patch implies that WIN32 is in fact defined.  So can you tell what's going on here?

Whatever is going on, the proper fix would be to use vsnprintf(), not _snprintf().

Mark





More information about the Zlib-devel mailing list