[Bug 762684] New: glib-2.14 regression ? snprintf/vsnprintf don't follow c99 standard
https://bugzilla.novell.com/show_bug.cgi?id=762684 https://bugzilla.novell.com/show_bug.cgi?id=762684#c0 Summary: glib-2.14 regression ? snprintf/vsnprintf don't follow c99 standard Classification: openSUSE Product: openSUSE 12.1 Version: Final Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: kkaempf@suse.com QAContact: qa-bugs@suse.de CC: aj@suse.com Found By: Development Blocker: --- The following ability of snprintf/vsnprintf does not work any more with openSUSE 12.1. It worked with previous versions and also with SLES 11 I have code relying on the fact that vsnprintf is able to count the number of required buffer characters by calling it with a NULL str pointer and a size of 0 (From 'man vsnprintf') " int vsnprintf(char *str, size_t size, const char *format, va_list ap); ... Concerning the return value of snprintf(), SUSv2 and C99 contradict each other: when snprintf() is called with size=0 then SUSv2 stipulates an unspecified return value less than 1, while C99 allows str to be NULL in this case, and gives the return value (as always) as the number of characters that would have been written in case the output string has been large enough. ... NOTES ... The glibc implementation of the functions snprintf() and vsnprintf() conforms to the C99 standard" Thus calling len = vsnprintf(NULL, 0, format, ap); should be allowed to compute the number of required buffer characters. ==> This does not work any more in openSUSE 12.1 vsnprintf returns -1 in this case with errno unchanged Workaround: Use a 1-character buffer -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=762684
https://bugzilla.novell.com/show_bug.cgi?id=762684#c1
Marcus Meissner
https://bugzilla.novell.com/show_bug.cgi?id=762684
https://bugzilla.novell.com/show_bug.cgi?id=762684#c2
--- Comment #2 from Klaus Kämpf
https://bugzilla.novell.com/show_bug.cgi?id=762684
https://bugzilla.novell.com/show_bug.cgi?id=762684#c3
Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=762684
https://bugzilla.novell.com/show_bug.cgi?id=762684#c4
Andreas Jaeger
participants (1)
-
bugzilla_noreply@novell.com