From 0e8a03dc36b1c0305b0db31861ab7cd2ab3b36d6 Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Mon, 15 Oct 2007 22:48:24 +0000 Subject: Fix recursion when search string is pure wildcard svn path=/trunk/netsurf/; revision=3633 --- riscos/search.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/riscos/search.c b/riscos/search.c index 947b39a01..8226fee92 100644 --- a/riscos/search.c +++ b/riscos/search.c @@ -328,6 +328,7 @@ void start_search(bool forwards) { int string_len; char *string; + int i = 0; string = ro_gui_get_icon_string(dialog_search, ICON_SEARCH_TEXT); assert(string); @@ -335,7 +336,9 @@ void start_search(bool forwards) ro_gui_search_add_recent(string); string_len = strlen(string); - if (string_len <= 0) { + for(i = 0; i < string_len; i++) + if (string[i] != '#' && string[i] != '*') break; + if (i >= string_len) { free_matches(); show_status(true); ro_gui_set_icon_shaded_state(dialog_search, @@ -643,7 +646,7 @@ const char *find_pattern(const char *string, int s_len, const char *pattern, } /* end of pattern reached */ - *m_len = s - ss; + *m_len = max(s - ss, 1); return ss; } -- cgit v1.2.3