On Fri, Dec 21, 2001 at 01:52:12PM -0800, Medland, Bill wrote:
Bill Medland (medbi01@accpac.com) Don't ask me why but on my setup vsnprintf returned a value greater than
This is the new and correct behavior according to the C99 standard. All snprintf function should return in error case the number of characters that would have been written to the buffer if the size of buffer would have been big enough. This change while usefull will brake a lot of things. IMO the glibc is still using the old behavior.
bye michael
the size of the buffer (much bigger), resulting in the debugger tripping a segment violation. Considering the location of this code I see no problem with using belts and braces; it isn't going to be executed much but when it is we want it to work (despite braindead operating systems)
On Fri, 21 Dec 2001, Michael Stefaniuc wrote:
On Fri, Dec 21, 2001 at 01:52:12PM -0800, Medland, Bill wrote:
Bill Medland (medbi01@accpac.com) Don't ask me why but on my setup vsnprintf returned a value greater than
This is the new and correct behavior according to the C99 standard. All snprintf function should return in error case the number of characters that would have been written to the buffer if the size of buffer would have been big enough. This change while usefull will brake a lot of things. IMO the glibc is still using the old behavior.
By the way did someone do a systematic check for this problem? Might be worth it...
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ "Utilisateur" (nom commun) : Mot utilisé par les informaticiens en lieu et place d'"idiot".
On Tue, Dec 25, 2001 at 01:38:26PM -0800, Francois Gouget wrote:
On Fri, 21 Dec 2001, Michael Stefaniuc wrote:
On Fri, Dec 21, 2001 at 01:52:12PM -0800, Medland, Bill wrote:
Bill Medland (medbi01@accpac.com) Don't ask me why but on my setup vsnprintf returned a value greater than
This is the new and correct behavior according to the C99 standard. All snprintf function should return in error case the number of characters that would have been written to the buffer if the size of buffer would have been big enough. This change while usefull will brake a lot of things. IMO the glibc is still using the old behavior.
I was wrong, it's using the C99 behaviour (at least on Red Hat Linux 7.x)
By the way did someone do a systematic check for this problem? Might be worth it...
I did a short check with camus:~/work/wine$ grep -r -I -C snprintf ./ | less and this is what I found: - most of the time the return value of *snprintf isn't checked - if the return value is checked it's mostly checked for C89 and C99 style - the attached patch should fix all the remaining cases.
Changelog: Michael Stefaniuc mstefani@redhat.com check the return value of *snprintf for C99 style
bye michael
Hello,
please do not apply the previous patch, i did something very stupid. Use the attached patch instead (makes also better use of the C99 style return value).
bye michael
On Wed, Dec 26, 2001 at 01:09:06AM +0100, Michael Stefaniuc wrote: [snip]
I did a short check with camus:~/work/wine$ grep -r -I -C snprintf ./ | less and this is what I found:
- most of the time the return value of *snprintf isn't checked
- if the return value is checked it's mostly checked for C89 and C99 style
- the attached patch should fix all the remaining cases.
Changelog: Michael Stefaniuc mstefani@redhat.com check the return value of *snprintf for C99 style overflow reporting