mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 00:07:36 +08:00
The strcasecmp family of functions (strcasecmp, strncasecmp, strcasecmp_l, strncasecmp_l) call tolower on the incoming character before comparison. tolower takes an int as parameter. All four strcasecmp functions neglect to cast the character to unsigned before using it as parameter to tolower. This tolower is called with negative values if the incoming character is not in the ASCII range. This breaks case-insensitive comparison in other singlebyte codesets like ISO-8859-1 with native characters. Adding casts to unsigned char when calling tolower fixes it. Reported-by: Bruno Haible <bruno@clisp.org> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>