Stop at end of buffer.

pull/2219/head
Nicholas Marriott 2020-05-15 15:05:49 +01:00
parent 3e60ab1caf
commit e23c73457a
1 changed files with 1 additions and 1 deletions

View File

@ -878,7 +878,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
}
if (end == len)
return (1);
if (buf[end] != '~' && buf[end] != 'u')
if (end == sizeof tmp || (buf[end] != '~' && buf[end] != 'u'))
return (-1);
/* Copy to the buffer. */