summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2018-09-03 08:51:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2018-09-03 08:51:44 +0000
commit06a86c1debc540690108c7835caa5c46f56d6e69 (patch)
tree804c645a70dfe655ac3c74f3d159a4ae9836ddfc /usr.bin/tmux
parent319c8b4c96ffb7961b3386161f5aa0fe270bf81b (diff)
Allow a large line number to go to the end with goto-line, from Mark
Kelly in GitHub issue 1460.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/window-copy.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 80be2e6c588..a3ebb8d0cf1 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.198 2018/09/03 08:47:27 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.199 2018/09/03 08:51:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1273,11 +1273,13 @@ window_copy_goto_line(struct window_pane *wp, const char *linestr)
{
struct window_copy_mode_data *data = wp->modedata;
const char *errstr;
- u_int lineno;
+ int lineno;
- lineno = strtonum(linestr, 0, screen_hsize(data->backing), &errstr);
+ lineno = strtonum(linestr, -1, INT_MAX, &errstr);
if (errstr != NULL)
return;
+ if (lineno < 0 || (u_int)lineno > screen_hsize(data->backing))
+ lineno = screen_hsize(data->backing);
data->oy = lineno;
window_copy_update_selection(wp, 1);