Skip to content

Commit 5e1107c

Browse files
committed
Fix a bug in strcasestr
It must use strncasecmp, not strncmp
1 parent 1fcfd35 commit 5e1107c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

string/strcasestr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ __strcasestr (const char* s, const char* wanted)
3737
firstc = *wanted;
3838
len = strlen (wanted);
3939
for (scan = s;
40-
toupper (*scan) != toupper (firstc) || strncmp(scan, wanted, len) != 0; )
40+
toupper (*scan) != toupper (firstc) || strncasecmp(scan, wanted, len) != 0; )
4141
if (*scan++ == '\0')
4242
return NULL;
4343
return (char*) scan;

0 commit comments

Comments
 (0)