From ee4a0bd4adc49bc16d8a400791c3cc73679effd4 Mon Sep 17 00:00:00 2001 From: Don Scorgie Date: Mon, 20 Nov 2006 18:49:29 +0000 Subject: 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) --- ChangeLog | 8 +++++++- src/yelp-info-parser.c | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e633467e..306425c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-20 Don Scorgie + + * 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 * 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 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); -- cgit v1.2.1