From 237e3f4dcb517a80cb58499ef3e73fccf06d1a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Fri, 20 Feb 2015 17:10:56 -0200 Subject: [PATCH] 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)); --- sys/posix/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/posix/strings.c b/sys/posix/strings.c index e80bad3e2a..03136f2a0b 100644 --- a/sys/posix/strings.c +++ b/sys/posix/strings.c @@ -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; }