From: Pierre Habouzit Date: Sat, 2 Dec 2006 13:34:23 +0000 (+0100) Subject: oops, ascii_strncasecmp tried to compare one byte too far X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=33d7570d66fa131d801880a7786c8303cd867aaf;p=apps%2Fmadmutt.git oops, ascii_strncasecmp tried to compare one byte too far Signed-off-by: Pierre Habouzit --- diff --git a/lib-lib/str.c b/lib-lib/str.c index 39e6a90..f421530 100644 --- a/lib-lib/str.c +++ b/lib-lib/str.c @@ -181,9 +181,9 @@ int ascii_strcasecmp(const char *a, const char *b) if (a == b) return 0; if (!a) - a = ""; + return -1; if (!b) - b = ""; + return 1; while (*a || *b) { int i; @@ -206,11 +206,11 @@ int ascii_strncasecmp(const char *a, const char *b, ssize_t n) if (a == b) return 0; if (!a) - a = ""; + return -1; if (!b) - b = ""; + return 1; - while ((*a || *b) && n >= 0) { + while ((*a || *b) && n > 0) { int i; if ((i = ascii_tolower(*a++) - ascii_tolower(*b++))) return i;