summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-11 10:39:28 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-11 10:39:28 +0000
commita481a233e01070890f72454677097ad279aee0b4 (patch)
tree8ed00c5c5bfae35da0df81c9774fea6b687fbe81 /usr.bin
parent37b61279ea9136750e6c4b6b3aa1ee73e8033c4c (diff)
Set the current window pointer to NULL when killing a winlink that is to be
replaced with link-window -k. This prevents it being pushed onto the last window stack and causing a use-after-free. Only took me an hour to find this :-/...
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/server-fn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index 78cc1ba5fa4..bfcc8111b1d 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.25 2009/10/10 10:02:48 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.26 2009/10/11 10:39:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -284,8 +284,10 @@ server_link_window(struct session *src, struct winlink *srcwl,
winlink_remove(&dst->windows, dstwl);
/* Force select/redraw if current. */
- if (dstwl == dst->curw)
+ if (dstwl == dst->curw) {
selectflag = 1;
+ dst->curw = NULL;
+ }
}
}