Do not look at next key byte if the length is 0, originally from Shingo

NISHIOKA in GitHub issue 1601.
pull/1611/head
nicm 2019-02-16 19:04:34 +00:00
parent 82f0c859a2
commit fa33603dc1
1 changed files with 4 additions and 0 deletions

View File

@ -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);