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:
Andre Heider 2012-08-02 20:59:43 +02:00 committed by Kristian Høgsberg
parent 5626d34d63
commit 552d12b10e

View File

@ -2268,6 +2268,9 @@ static int wordsep(int ch)
{
const char extra[] = "-,./?%&#:_=+@~";
if (ch > 127)
return 1;
return ch == 0 || !(isalpha(ch) || isdigit(ch) || strchr(extra, ch));
}