diff options
author | 2018-06-03 10:17:30 +0000 | |
---|---|---|
committer | 2018-06-03 10:17:30 +0000 | |
commit | c72e5d6148e9b09cd4544cd97491bc5c5fdcaed0 (patch) | |
tree | eb1922368bbd8f20d4dd48a412ec17322b17e2c0 /usr.bin/tmux/grid.c | |
parent | Add placeholder for lang/php. (diff) | |
download | wireguard-openbsd-c72e5d6148e9b09cd4544cd97491bc5c5fdcaed0.tar.xz wireguard-openbsd-c72e5d6148e9b09cd4544cd97491bc5c5fdcaed0.zip |
Increment the lines counter when skipping a line to avoid an infinite
loop, and fix a check to avoid a potential out-of-bounds access. Problem
reported by Yuxiang Qin and tracked down by Karl Beldan; GitHub issue
1352.
Also a man page fix request by jmc@.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r-- | usr.bin/tmux/grid.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index 847aeb6a4b2..1d66778a025 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.81 2018/04/18 14:31:42 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.82 2018/06/03 10:17:30 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1011,7 +1011,7 @@ grid_reflow_join(struct grid *target, struct grid *gd, u_int sx, u_int yy, * If this is now the last line, there is nothing more to be * done. */ - if (yy + lines == gd->hsize + gd->sy) + if (yy + 1 + lines == gd->hsize + gd->sy) break; line = yy + 1 + lines; @@ -1021,6 +1021,7 @@ grid_reflow_join(struct grid *target, struct grid *gd, u_int sx, u_int yy, if (gd->linedata[line].cellused == 0) { if (!wrapped) break; + lines++; continue; } |