diff options
author | Don Scorgie <dscorgie@src.gnome.org> | 2006-11-20 18:49:29 +0000 |
---|---|---|
committer | Don Scorgie <dscorgie@src.gnome.org> | 2006-11-20 18:49:29 +0000 |
commit | ee4a0bd4adc49bc16d8a400791c3cc73679effd4 (patch) | |
tree | bad35846dcb830c9f4c11fffed545a9ff09cfde7 | |
parent | 1f8042ca33746ca0cacae5392b65e1974c174fc6 (diff) | |
download | yelp-ee4a0bd4adc49bc16d8a400791c3cc73679effd4.tar.gz |
When whitespace on new line of a note is < 2, don't crash (bug #376861)
* src/yelp-info-parser.c:
When whitespace on new line of a note is < 2,
don't crash (bug #376861)
Fix crash on libc info page (bug #367410, Matthias Clasen)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/yelp-info-parser.c | 11 |
2 files changed, 14 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2006-11-20 Don Scorgie <dscorgie@cvs.gnome.org> + + * src/yelp-info-parser.c: + When whitespace on new line of a note is < 2, + don't crash (bug #376861) + Fix crash on libc info page (bug #367410, Matthias Clasen) + 2006-11-05 Don Scorgie <dscorgie@cvs.gnome.org> * src/yelp-main.c: @@ -8,7 +15,6 @@ Stops from crashing (bug #364768) Don't chew memory when search string contains 2 consecutive spaces - 2006-10-25 Don Scorgie <dscorgie@cvs.gnome.org> diff --git a/src/yelp-info-parser.c b/src/yelp-info-parser.c index ea095aad..c462aac7 100644 --- a/src/yelp-info-parser.c +++ b/src/yelp-info-parser.c @@ -1020,13 +1020,12 @@ info_process_text_notes (xmlNodePtr *node, gchar *content, GtkTreeStore *tree) if (alt_append) append = alt_append; else append = alt_append1; } - if ((alt_append && alt_append < append) || broken) + if ((alt_append && alt_append < append)) append = alt_append; if (alt_append1 && alt_append1 < append) append = alt_append1; } append++; - url = g_strndup (*current_real, append - (*current_real)); /* By now, we got 2 things. First, is append which is the (hopefully) @@ -1127,13 +1126,17 @@ info_process_text_notes (xmlNodePtr *node, gchar *content, GtkTreeStore *tree) else { gchar *spacing = *ulink; gchar *tmp; + gint count = 0; while (*spacing == ' ') { spacing++; + count++; } if (spacing != *ulink) { - spacing-=2; + if (count > 1) + spacing-=2; tmp = g_strndup (*ulink, spacing-*ulink); - spacing+=2; + if (count > 1) + spacing+=2; xmlNewTextChild (holder, NULL, BAD_CAST "spacing", BAD_CAST tmp); g_free (tmp); |