From: nicm Date: Mon, 6 Dec 2021 10:08:42 +0000 (+0000) Subject: Do not dereference NULL window when resizing client, GitHub issue 2982. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8c20af2cb7b3e011dc2bd8ffe6e62d0ef7617e67;p=openbsd Do not dereference NULL window when resizing client, GitHub issue 2982. --- diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c index 99df95eb0da..bc141e50be6 100644 --- a/usr.bin/tmux/resize.c +++ b/usr.bin/tmux/resize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.47 2021/08/27 17:15:57 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.48 2021/12/06 10:08:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -348,6 +348,8 @@ recalculate_size_skip_client(struct client *loop, __unused int type, * is not the current window - this is used for aggressive-resize. * Otherwise skip any session that doesn't contain the window. */ + if (loop->session->curw == NULL) + return (1); if (current) return (loop->session->curw->window != w); return (session_has(loop->session, w) == 0); diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index a10567d5d4b..f67e9c5bf83 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.412 2021/11/29 11:05:28 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.413 2021/12/06 10:08:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -937,7 +937,9 @@ tty_update_window_offset(struct window *w) struct client *c; TAILQ_FOREACH(c, &clients, entry) { - if (c->session != NULL && c->session->curw->window == w) + if (c->session != NULL && + c->session->curw != NULL && + c->session->curw->window == w) tty_update_client_offset(c); } }