After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 92492 - g_string_printf() and embedded NULs
g_string_printf() and embedded NULs
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.0.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on: 112365
Blocks:
 
 
Reported: 2002-09-04 16:32 UTC by Owen Taylor
Modified: 2011-02-18 16:13 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
patch and testcase (1.33 KB, patch)
2003-05-16 20:24 UTC, Matthias Clasen
none Details | Review

Description Owen Taylor 2002-09-04 16:32:13 UTC
g_string_printf() could be used in cases where the result
of printf() includes embedded NULs, and we support embedded
NULs for GString. But g_string_printf() uses g_strdup_vprintf()
which doesn't return the length, so we end up using 
strlen().

See: 

 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=73425

Fixing this would require g_strdup_vprintf_len(&str, &len, fmt, args)
or something.
Comment 1 Matthias Clasen 2003-05-16 20:24:03 UTC
Created attachment 16575 [details] [review]
patch and testcase
Comment 2 Matthias Clasen 2003-05-16 20:26:38 UTC
The patch also fixes bug 101997.