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 549707 - g_strstr_len() ignores haystack_len
g_strstr_len() ignores haystack_len
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-08-28 13:03 UTC by Bastien Nocera
Modified: 2018-05-24 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bastien Nocera 2008-08-28 13:03:38 UTC
g_strstr_len() ignores the haystack_len, and will only process the haystack up until the first nul-terminator, even though haystack_len is defined.

g_strstr_len() should process the string up to haystack_len instead of stopping in the middle.
Comment 1 Behdad Esfahbod 2008-08-28 18:46:52 UTC
See bug 332672.  Unfortunately many glib string functions (as well as pango_layout_set_text()) use the provided len as a "max len", making it much less useful than it could be if it was simply "len".  I don't think it's possible to change this meaning at this time.  When I asked Owen why this is the case, he said that the max-len argument is supposed to be used for things like "truncating" strings.  However, one can't do such things with UTF-8 without examining the string first, so that use case is moot.
Comment 2 GNOME Infrastructure Team 2018-05-24 11:32:09 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/159.