summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-07-02 16:15:43 +0000
committernicm <nicm@openbsd.org>2009-07-02 16:15:43 +0000
commit92e1fe33b4acbba8302d657e18e95c726b0dbfc6 (patch)
treeabf72dd88cc67b8172c4e67b2eb57c2984168a2f /usr.bin/tmux/window-copy.c
parentRewrite the sysctl handlers to use libc functions (getifaddrs and (diff)
downloadwireguard-openbsd-92e1fe33b4acbba8302d657e18e95c726b0dbfc6.tar.xz
wireguard-openbsd-92e1fe33b4acbba8302d657e18e95c726b0dbfc6.zip
Fix two copy/paste bugs: forbid zero-length buffers to prevent a fatal error
when trying to paste them, found by me, and miscalculation of the start/end causing random fatal errors when copying in copy-mode, reported by sthen. ok sthen "put it in" deraadt
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 8a291bfc11c..400738192d7 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.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.2 2009/07/02 16:15:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -423,7 +423,7 @@ window_copy_copy_selection(struct window_pane *wp, struct client *c)
/* Find start and end. */
xx = data->cx + data->ox;
yy = screen_hsize(&wp->base) + data->cy - data->oy;
- if (xx < data->selx || (yy == data->sely && xx < data->selx)) {
+ if (yy < data->sely || (yy == data->sely && xx < data->selx)) {
sx = xx; sy = yy;
ex = data->selx; ey = data->sely;
} else {