summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-02-16 19:04:34 +0000
committernicm <nicm@openbsd.org>2019-02-16 19:04:34 +0000
commit7fa57c5baf91be51d7586f0dfa83e5b3083d7edf (patch)
treee3121c081d9e16a190204662505c8462552f0bd5 /usr.bin/tmux/tty-keys.c
parentSSID/LLADDR/LINK_STATE_IS_UP changes must discard the previous (diff)
downloadwireguard-openbsd-7fa57c5baf91be51d7586f0dfa83e5b3083d7edf.tar.xz
wireguard-openbsd-7fa57c5baf91be51d7586f0dfa83e5b3083d7edf.zip
Do not look at next key byte if the length is 0, originally from Shingo
NISHIOKA in GitHub issue 1601.
Diffstat (limited to 'usr.bin/tmux/tty-keys.c')
-rw-r--r--usr.bin/tmux/tty-keys.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 8a72a498cf0..9aba03a42bd 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.105 2018/10/28 15:34:27 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.106 2019/02/16 19:04:34 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -464,6 +464,10 @@ tty_keys_find(struct tty *tty, const char *buf, size_t len, size_t *size)
static struct tty_key *
tty_keys_find1(struct tty_key *tk, const char *buf, size_t len, size_t *size)
{
+ /* If no data, no match. */
+ if (len == 0)
+ return (NULL);
+
/* If the node is NULL, this is the end of the tree. No match. */
if (tk == NULL)
return (NULL);