summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-09-10 13:34:12 +0000
committerTiago Cunha <tcunha@gmx.com>2010-09-10 13:34:12 +0000
commit28a0b6fd20cbd8834c8918836ed42a6765c4cdf0 (patch)
tree82233358cf81d1394f15787444f409bd7924b4c0
parentf54482a4612ef9f409e7ffe247b621ce90604d48 (diff)
Sync OpenBSD patchset 758:
Do not crash if the screen size is too small for the indicator in copy mode.
-rw-r--r--window-copy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/window-copy.c b/window-copy.c
index fdacdfc1..78c33736 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1,4 +1,4 @@
-/* $Id: window-copy.c,v 1.122 2010-07-22 19:51:48 micahcowan Exp $ */
+/* $Id: window-copy.c,v 1.123 2010-09-10 13:34:12 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1055,6 +1055,8 @@ window_copy_write_line(
if (py == 0) {
size = xsnprintf(hdr, sizeof hdr,
"[%u/%u]", data->oy, screen_hsize(data->backing));
+ if (size > screen_size_x(s))
+ size = screen_size_x(s);
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
screen_write_puts(ctx, &gc, "%s", hdr);
} else if (py == last && data->inputtype != WINDOW_COPY_OFF) {