From 552d12b10e1faa3f8c8340fcf5fe889b859cd5b0 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 2 Aug 2012 20:59:43 +0200 Subject: [PATCH] terminal: Don't crash on non-ascii chars isalpha() and isdigit() don't like huge values. Noticed with ascii-art in the shell prompt. --- clients/terminal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clients/terminal.c b/clients/terminal.c index 782f087b..aa072cd7 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -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)); }