commit 1411224b169b5a2d134111b068e17f3020753ca9
Author: Hiltjo Posthuma <[email protected]>
AuthorDate: Mon Dec 16 18:26:01 2019 +0100
Commit: Hiltjo Posthuma <[email protected]>
CommitDate: Mon Dec 16 18:26:01 2019 +0100
fix undefined behaviour of use of isalpha, isdigit and tolower
"The argument c must be EOF or representable as an unsigned char;
otherwise, the result is undefined."
diff --git a/ii.c b/ii.c
index 55d5f52..94da8ab 100644
--- a/ii.c
+++ b/ii.c
@@ -140,9 +140,9 @@ static void
channel_normalize_path(char *s)
{
for (; *s; s++) {
- if (isalpha(*s))
- *s = tolower(*s);
- else if (!isdigit(*s) && !strchr(".#&+!-", *s))
+ if (isalpha((unsigned char)*s))
+ *s = tolower((unsigned char)*s);
+ else if (!isdigit((unsigned char)*s) && !strchr(".#&+!-", *s))
*s = '_';
}
}