From 5e1107c133fd122c080317815b68e0a89b494684 Mon Sep 17 00:00:00 2001 From: Thorsten Otto Date: Sun, 7 Jul 2024 17:57:36 +0200 Subject: [PATCH] Fix a bug in strcasestr It must use strncasecmp, not strncmp --- string/strcasestr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/string/strcasestr.c b/string/strcasestr.c index 5fd0edd..13f7a00 100644 --- a/string/strcasestr.c +++ b/string/strcasestr.c @@ -37,7 +37,7 @@ __strcasestr (const char* s, const char* wanted) firstc = *wanted; len = strlen (wanted); for (scan = s; - toupper (*scan) != toupper (firstc) || strncmp(scan, wanted, len) != 0; ) + toupper (*scan) != toupper (firstc) || strncasecmp(scan, wanted, len) != 0; ) if (*scan++ == '\0') return NULL; return (char*) scan;