From 6dc894d511e3b4aae6cbf6ac198f2171766105c1 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Wed, 14 Apr 2010 18:09:12 +0300 Subject: Fix an issue with strstrcasedecomp_needle_stripped() Previous patch by Alban introduces a read-after-end error in get_next(). This is a more robust attempt at skipping but not aborting on control characters. Signed-off-by: Claudio Saavedra --- hildon/hildon-helper.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hildon/hildon-helper.c b/hildon/hildon-helper.c index 9687e95..4fb1033 100644 --- a/hildon/hildon-helper.c +++ b/hildon/hildon-helper.c @@ -610,7 +610,7 @@ get_next (const gchar *p, gunichar *out, gboolean separators) q = p; p = e_util_unicode_get_utf8 (q, &utf8); *out = stripped_char (utf8); - } while (p && !g_unichar_isalnum (*out)); + } while (p && utf8 && !g_unichar_isalnum (*out)); } else { p = e_util_unicode_get_utf8 (p, &utf8); *out = stripped_char (utf8); @@ -669,11 +669,7 @@ hildon_helper_utf8_strstrcasedecomp_needle_stripped (const gchar *haystack, cons gint npos = 1; while (npos < nlen) { q = e_util_unicode_get_utf8 (q, &unival); - if (!q) return NULL; - if (!unival) { - npos++; - continue; - } + if (!q || !unival) return NULL; sc = stripped_char (unival); if ((!sc) || (sc != nuni[npos])) break; npos++; -- cgit v1.2.3-18-g5258