diff --git a/sys/libkern/strcasecmp.c b/sys/libkern/strcasecmp.c index 8e658274887..a0586549ff5 100644 --- a/sys/libkern/strcasecmp.c +++ b/sys/libkern/strcasecmp.c @@ -43,11 +43,12 @@ strcasecmp(const char *s1, const char *s2) { const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; - while (tolower(*us1) == tolower(*us2++)) { + while (tolower(*us1) == tolower(*us2)) { if (*us1++ == '\0') return (0); + us2++; } - return (tolower(*us1) - tolower(*--us2)); + return (tolower(*us1) - tolower(*us2)); } int @@ -59,10 +60,11 @@ strncasecmp(const char *s1, const char *s2, size_t n) const u_char *us2 = (const u_char *)s2; do { - if (tolower(*us1) != tolower(*us2++)) - return (tolower(*us1) - tolower(*--us2)); + if (tolower(*us1) != tolower(*us2)) + return (tolower(*us1) - tolower(*us2)); if (*us1++ == '\0') break; + us2++; } while (--n != 0); } return (0);