diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-03-14 23:31:24 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-03-14 23:31:24 +0000 |
commit | 5c6bca1df15b60992ff8b94ff918b7b1d551ce80 (patch) | |
tree | bc1d3c93b73f7fe6f6cdb27b1ce9960964cb905b | |
parent | ef6d9230beab2540f223e0018ef15743cdc83814 (diff) |
Fix a use-after-free when cancelling copy mode, or trying to repeat cancel.
ok kettenis
-rw-r--r-- | usr.bin/tmux/window-copy.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 729e15d0b7b..b7f9b95e9ab 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.50 2010/03/02 00:32:41 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.51 2010/03/14 23:31:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -256,9 +256,8 @@ window_copy_key(struct window_pane *wp, struct client *c, int key) cmd = mode_key_lookup(&data->mdata, key); switch (cmd) { case MODEKEYCOPY_CANCEL: - for (; np != 0; np--) - window_pane_reset_mode(wp); - break; + window_pane_reset_mode(wp); + return; case MODEKEYCOPY_LEFT: for (; np != 0; np--) window_copy_cursor_left(wp); @@ -366,6 +365,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key) if (c != NULL && c->session != NULL) { window_copy_copy_selection(wp, c); window_pane_reset_mode(wp); + return; } break; case MODEKEYCOPY_STARTOFLINE: |