dlls/user: w[v]snprintf[A|W] fixes

David Laight david at l8s.co.uk
Sun Oct 27 03:39:27 CST 2002

> > Changelog:
> > * dlls/user/wsprintf.c Jaco Greeff <jaco at puxedo.org>
> > - Changed the wsprintf[A|W] and wvsprintf[A|W] functions to
> >   determine the size of the destination buffer before writing
> >   to it. Previously the size was hardcoded to 1024 bytes.
> The size is supposed to be hardcoded to 1024, that's how wsprintf
> works. You can't make it dynamic since the buffer is allocated by the
> application.

Seems to me (from info in a later post) that M$ wsprintf uses an
internal temporary buffer that has a size of 1024 - thus resticting
the user to a buffer size of 1024,

The actual size of the user buffer cannot be determined - hence
the common 'buffer overflow' issues with sprintf.

The C standard now includes snprintf() where the application passes
in the length of the target buffer.  I guess M$ might follow :-)

Some systems also have an asprintf() routine which will malloc() a
buffer that the caller must free().


David Laight: david at l8s.co.uk

More information about the wine-devel mailing list