aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-19 14:46:56 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-19 14:46:56 +0000
commit55336657d45196221203cbaa162128755243bb0c (patch)
tree9cddd3d9201691263f556b79f01edd9e56307e53
parentc41aa49059a3c5d475a55c174aa0f7b509f67534 (diff)
downloadrtmux-55336657d45196221203cbaa162128755243bb0c.tar.gz
rtmux-55336657d45196221203cbaa162128755243bb0c.tar.bz2
rtmux-55336657d45196221203cbaa162128755243bb0c.zip
Don't read beyond the edge of the screen when searching (dies with debug
enabled).
-rw-r--r--window-copy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/window-copy.c b/window-copy.c
index 4ee3d4e3..63c31829 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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))