diff options
author | 2015-11-14 10:56:31 +0000 | |
---|---|---|
committer | 2015-11-14 10:56:31 +0000 | |
commit | 27a2633f85b4171a63c264356037c2d86c882987 (patch) | |
tree | 0c7dc273e0021238ae23fbfe19a618abe5652aa2 /usr.bin/tmux/key-string.c | |
parent | Push stdout and stderr to clients more aggressively, and add an event to (diff) | |
download | wireguard-openbsd-27a2633f85b4171a63c264356037c2d86c882987.tar.xz wireguard-openbsd-27a2633f85b4171a63c264356037c2d86c882987.zip |
Be more strict about invalid UTF-8.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index 61e70fe6273..838bfe64051 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.29 2015/11/12 22:04:37 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.30 2015/11/14 10:56:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -144,7 +144,7 @@ key_string_lookup_string(const char *string) static const char *other = "!#()+,-.0123456789:;<=>?'\r\t"; key_code key; u_short u; - int size; + int size, more; key_code modifiers; struct utf8_data ud; u_int i; @@ -177,7 +177,9 @@ key_string_lookup_string(const char *string) if (strlen(string) != ud.size) return (KEYC_NONE); for (i = 1; i < ud.size; i++) - utf8_append(&ud, (u_char)string[i]); + more = utf8_append(&ud, (u_char)string[i]); + if (more != 0) + return (KEYC_NONE); key = utf8_combine(&ud); return (key | modifiers); } |