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 528339 - string_replace function in tracker-configuration.c is broken
string_replace function in tracker-configuration.c is broken
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: Preferences
unspecified
Other All
: Normal normal
: ---
Assigned To: Jamie McCracken
Jamie McCracken
Depends on:
Blocks:
 
 
Reported: 2008-04-16 01:48 UTC by Joshua Gerrish
Modified: 2008-04-24 03:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix string_replace function (800 bytes, patch)
2008-04-16 01:49 UTC, Joshua Gerrish
none Details | Review

Description Joshua Gerrish 2008-04-16 01:48:39 UTC
Please describe the problem:
The string_replace function in tracker-configuration.c doesn't work.  start_pos is not initialized to the beginning of the string, and the end_pos and start_pos variables are swapped in the append function.

Steps to reproduce:
1. Add several newlines to end of tracker.cfg
2. Run tracker-preferences

Actual results:
segfault in string_replace

Expected results:
Any occurrence of "needle" in "haystack" should be replaced with "replacement"

Does this happen every time?
Yes

Other information:
Patch attached.  Probably needs more thorough testing
Comment 1 Joshua Gerrish 2008-04-16 01:49:45 UTC
Created attachment 109350 [details] [review]
Patch to fix string_replace function
Comment 2 Tshepang Lekhonkhobe 2008-04-17 11:23:40 UTC
Thanks so much for this patch for it fixes such a long-standing problem for me, if applied with #528336.
Comment 3 Jamie McCracken 2008-04-24 03:29:36 UTC
Applied to svn - thanks