about summary refs log tree commit diff
path: root/string/strcasestr.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/strcasestr.c')
-rw-r--r--string/strcasestr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string/strcasestr.c b/string/strcasestr.c
index 90ba189790..5909fe3cdb 100644
--- a/string/strcasestr.c
+++ b/string/strcasestr.c
@@ -37,8 +37,8 @@
 /* Two-Way algorithm.  */
 #define RETURN_TYPE char *
 #define AVAILABLE(h, h_l, j, n_l)			\
-  (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l))	\
-   && ((h_l) = (j) + (n_l)))
+  (((j) + (n_l) <= (h_l)) || ((h_l) += __strnlen ((void*)((h) + (h_l)), 512), \
+			      (j) + (n_l) <= (h_l)))
 #define CHECK_EOL (1)
 #define RET0_IF_0(a) if (!a) goto ret0
 #define CANON_ELEMENT(c) TOLOWER (c)