summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-08-19 14:46:56 +0000
committernicm <nicm@openbsd.org>2009-08-19 14:46:56 +0000
commit540fe721ce987013b521b731d9c874aab50574a0 (patch)
treefb4744c44c39d8e5d9376a3a483194b816806db5
parentUse cfsetispeed/cfsetospeed to set termios speed members. (diff)
downloadwireguard-openbsd-540fe721ce987013b521b731d9c874aab50574a0.tar.xz
wireguard-openbsd-540fe721ce987013b521b731d9c874aab50574a0.zip
Don't read beyond the edge of the screen when searching (dies with debug
enabled).
-rw-r--r--usr.bin/tmux/window-copy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 7a660e817e4..d9ec0af6a70 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.23 2009/08/18 09:51:51 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.24 2009/08/19 14:46:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -504,6 +504,8 @@ window_copy_search_rl(struct grid *gd,
u_int ax, bx, px;
for (ax = last + 1; ax > first; ax--) {
+ if (gd->sx - (ax - 1) < sgd->sx)
+ continue;
for (bx = 0; bx < sgd->sx; bx++) {
px = ax - 1 + bx;
if (!window_copy_search_compare(gd, px, py, sgd, bx))