From 0e69fe996e85666f7ebda739f2a69cba828d99f9 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 30 May 2022 13:03:46 +0000 Subject: [PATCH] Do not allow pipe-pane on dead panes, from Anindya Mukherjee, GitHub issue 3174. --- usr.bin/tmux/cmd-pipe-pane.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c index fb1c71cea05..1ef733155f0 100644 --- a/usr.bin/tmux/cmd-pipe-pane.c +++ b/usr.bin/tmux/cmd-pipe-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-pipe-pane.c,v 1.59 2021/10/24 21:24:17 deraadt Exp $ */ +/* $OpenBSD: cmd-pipe-pane.c,v 1.60 2022/05/30 13:03:46 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -68,6 +68,12 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) struct format_tree *ft; sigset_t set, oldset; + /* Do nothing if pane is dead. */ + if (wp->fd == -1 || (wp->flags & PANE_EXITED)) { + cmdq_error(item, "target pane has exited"); + return (CMD_RETURN_ERROR); + } + /* Destroy the old pipe. */ old_fd = wp->pipe_fd; if (wp->pipe_fd != -1) { -- 2.20.1