terminal: Don't crash on non-ascii chars
isalpha() and isdigit() don't like huge values. Noticed with ascii-art in the shell prompt.
This commit is contained in:
parent
5626d34d63
commit
552d12b10e
@ -2268,6 +2268,9 @@ static int wordsep(int ch)
|
|||||||
{
|
{
|
||||||
const char extra[] = "-,./?%&#:_=+@~";
|
const char extra[] = "-,./?%&#:_=+@~";
|
||||||
|
|
||||||
|
if (ch > 127)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return ch == 0 || !(isalpha(ch) || isdigit(ch) || strchr(extra, ch));
|
return ch == 0 || !(isalpha(ch) || isdigit(ch) || strchr(extra, ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user