1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 23:41:18 +01:00

sys/posix: fix strncasecmp

This should be a OR or when comparing only parts os strings would
return a wrong value.

const char *first = "testA";
const char *second = "test";
uint8_t contains = strncasecmp(first, second, strlen(second));
This commit is contained in:
José Roberto de Souza 2015-02-20 17:10:56 -02:00
parent 258083323a
commit 237e3f4dcb

View File

@ -18,7 +18,7 @@
int strncasecmp(const char *s1, const char *s2, size_t n)
{
while (n-- && tolower((unsigned char) *s1) == tolower((unsigned char) *s2)) {
if (!n && !*s1) {
if (!n || !*s1) {
break;
}