aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-09-08 20:36:42 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-09-08 20:36:42 +0000
commitbbf743769bf0e71dbd6c0cc96aa6817662b939e1 (patch)
tree41f57ed97b146a8e771a4048ba2be0811ac51d14
parentde68c2a7da02cfecd0d4238bca1d1c88eaaba0e1 (diff)
downloadrtmux-bbf743769bf0e71dbd6c0cc96aa6817662b939e1.tar.gz
rtmux-bbf743769bf0e71dbd6c0cc96aa6817662b939e1.tar.bz2
rtmux-bbf743769bf0e71dbd6c0cc96aa6817662b939e1.zip
Do not crash if the screen size is too small for the indicator in copy mode.
-rw-r--r--window-copy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/window-copy.c b/window-copy.c
index 186f018d..5ab163cc 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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) {