summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-04-17 23:14:18 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-04-17 23:14:18 +0000
commit93f336525d6eae2394fb01f93e59c193dc715717 (patch)
tree751eadec815b0f834587e5f23d6c53ed9d5728ef /usr.bin
parentcb48bd111b349dafceab40372ffe880babd1e427 (diff)
Fix use-after-free of the window link when it is part of a grouped
session (and hence could have been recreated), from Micah Cowan.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-join-pane.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-join-pane.c b/usr.bin/tmux/cmd-join-pane.c
index 0917a270a46..e4a2d4ecd7d 100644
--- a/usr.bin/tmux/cmd-join-pane.c
+++ b/usr.bin/tmux/cmd-join-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-join-pane.c,v 1.2 2010/04/04 19:12:20 nicm Exp $ */
+/* $OpenBSD: cmd-join-pane.c,v 1.3 2010/04/17 23:14:17 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -151,13 +151,14 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
struct winlink *src_wl, *dst_wl;
struct window *src_w, *dst_w;
struct window_pane *src_wp, *dst_wp;
- int size;
+ int size, dst_idx;
enum layout_type type;
struct layout_cell *lc;
if ((dst_wl = cmd_find_pane(ctx, data->dst, &dst_s, &dst_wp)) == NULL)
return (-1);
dst_w = dst_wl->window;
+ dst_idx = dst_wl->idx;
if ((src_wl = cmd_find_pane(ctx, data->src, NULL, &src_wp)) == NULL)
return (-1);
@@ -210,7 +211,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (!data->flag_detached) {
window_set_active_pane(dst_w, src_wp);
- session_select(dst_s, dst_wl->idx);
+ session_select(dst_s, dst_idx);
server_redraw_session(dst_s);
} else
server_status_session(dst_s);