mirror of
https://github.com/tmux/tmux.git
synced 2026-10-06 17:49:52 +00:00
Discard keys if there is no session, fixes crash reported by Artyom
Pertsovsky.
This commit is contained in:
12
tty-keys.c
12
tty-keys.c
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: tty-keys.c,v 1.214 2026/08/18 09:01:20 nicm Exp $ */
|
/* $OpenBSD: tty-keys.c,v 1.215 2026/09/25 10:37:05 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -761,6 +761,16 @@ tty_keys_next(struct tty *tty)
|
|||||||
return (0);
|
return (0);
|
||||||
log_debug("%s: keys are %zu (%.*s)", c->name, len, (int)len, buf);
|
log_debug("%s: keys are %zu (%.*s)", c->name, len, (int)len, buf);
|
||||||
|
|
||||||
|
/* If the client has no session, there is nowhere to send input. */
|
||||||
|
if (c->session == NULL) {
|
||||||
|
log_debug("%s: discard keys with no session", c->name);
|
||||||
|
if (event_initialized(&tty->key_timer))
|
||||||
|
evtimer_del(&tty->key_timer);
|
||||||
|
tty->flags &= ~TTY_TIMER;
|
||||||
|
evbuffer_drain(tty->in, len);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Is this a clipboard response? */
|
/* Is this a clipboard response? */
|
||||||
switch (tty_keys_clipboard(tty, buf, len, &size)) {
|
switch (tty_keys_clipboard(tty, buf, len, &size)) {
|
||||||
case 0: /* yes */
|
case 0: /* yes */
|
||||||
|
|||||||
Reference in New Issue
Block a user