-/* $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>
{
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);