aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Crequy <alban.crequy@collabora.co.uk>2010-04-14 18:09:12 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2010-04-14 18:14:38 +0300
commit6dc894d511e3b4aae6cbf6ac198f2171766105c1 (patch)
tree3540bd8d029de3134f436160663fe5bbe7e1e5c2
parent8642b6991fe6c9a6fc4fdf98e091a17817cea6af (diff)
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 <csaavedra@igalia.com>
-rw-r--r--hildon/hildon-helper.c8
1 files 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++;