[PATCH] terminal: Don't crash on non-ascii chars

Kristian Høgsberg hoegsberg at gmail.com
Fri Aug 3 09:54:24 PDT 2012


On Thu, Aug 02, 2012 at 08:59:43PM +0200, Andre Heider wrote:
> isalpha() and isdigit() don't like huge values.
> Noticed with ascii-art in the shell prompt.

Thanks, committed.

> ---
>  clients/terminal.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/clients/terminal.c b/clients/terminal.c
> index dd35ceb..cbcd1ec 100644
> --- a/clients/terminal.c
> +++ b/clients/terminal.c
> @@ -2266,6 +2266,9 @@ static int wordsep(int ch)
>  {
>  	const char extra[] = "-,./?%&#:_=+@~";
>  
> +	if (ch > 127)
> +		return 1;
> +
>  	return ch == 0 || !(isalpha(ch) || isdigit(ch) || strchr(extra, ch));
>  }
>  
> -- 
> 1.7.10.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list