mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-24 23:59:03 +01:00
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.
This commit is contained in:
parent
a2c86dcbf6
commit
842bc2b855
@ -151,13 +151,14 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
struct winlink *src_wl, *dst_wl;
|
struct winlink *src_wl, *dst_wl;
|
||||||
struct window *src_w, *dst_w;
|
struct window *src_w, *dst_w;
|
||||||
struct window_pane *src_wp, *dst_wp;
|
struct window_pane *src_wp, *dst_wp;
|
||||||
int size;
|
int size, dst_idx;
|
||||||
enum layout_type type;
|
enum layout_type type;
|
||||||
struct layout_cell *lc;
|
struct layout_cell *lc;
|
||||||
|
|
||||||
if ((dst_wl = cmd_find_pane(ctx, data->dst, &dst_s, &dst_wp)) == NULL)
|
if ((dst_wl = cmd_find_pane(ctx, data->dst, &dst_s, &dst_wp)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
dst_w = dst_wl->window;
|
dst_w = dst_wl->window;
|
||||||
|
dst_idx = dst_wl->idx;
|
||||||
|
|
||||||
if ((src_wl = cmd_find_pane(ctx, data->src, NULL, &src_wp)) == NULL)
|
if ((src_wl = cmd_find_pane(ctx, data->src, NULL, &src_wp)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -210,7 +211,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
|
|
||||||
if (!data->flag_detached) {
|
if (!data->flag_detached) {
|
||||||
window_set_active_pane(dst_w, src_wp);
|
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);
|
server_redraw_session(dst_s);
|
||||||
} else
|
} else
|
||||||
server_status_session(dst_s);
|
server_status_session(dst_s);
|
||||||
|
Loading…
Reference in New Issue
Block a user