summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/key-string.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-05-26 14:49:48 +0000
committernicm <nicm@openbsd.org>2016-05-26 14:49:48 +0000
commit4d0ecdf43fed3d1784b44ead894e536d3fb541ae (patch)
treefa40603b4b5237459259423abf8d3a070b61c0df /usr.bin/tmux/key-string.c
parenttests for the two segfaults in backref() that were just fixed (diff)
downloadwireguard-openbsd-4d0ecdf43fed3d1784b44ead894e536d3fb541ae.tar.xz
wireguard-openbsd-4d0ecdf43fed3d1784b44ead894e536d3fb541ae.zip
Extend 0x1234 keys form to more bits so that Unicode keys work.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r--usr.bin/tmux/key-string.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c
index e5a16e6b424..b78e0bb288e 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.37 2016/04/25 17:05:53 nicm Exp $ */
+/* $OpenBSD: key-string.c,v 1.38 2016/05/26 14:49:48 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -146,8 +146,7 @@ key_string_lookup_string(const char *string)
{
static const char *other = "!#()+,-.0123456789:;<=>?'\r\t";
key_code key;
- u_short u;
- int size;
+ u_int u;
key_code modifiers;
struct utf8_data ud;
u_int i;
@@ -160,7 +159,9 @@ key_string_lookup_string(const char *string)
/* Is this a hexadecimal value? */
if (string[0] == '0' && string[1] == 'x') {
- if (sscanf(string + 2, "%hx%n", &u, &size) != 1 || size > 4)
+ if (sscanf(string + 2, "%x", &u) != 1)
+ return (KEYC_UNKNOWN);
+ if (u > 0x1fffff)
return (KEYC_UNKNOWN);
return (u);
}