diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-06-03 10:17:31 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-06-03 10:17:31 +0000 |
commit | 471e07c4aa6cd620833fc51a70acf625764b6e1a (patch) | |
tree | 14cb4e37cd64ad7faaf2752400d84539e75adb20 | |
parent | a864943c81317ebb35da12fb9272665d995a1ad0 (diff) |
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@.
-rw-r--r-- | usr.bin/tmux/grid.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 7 |
2 files changed, 7 insertions, 5 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; } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index a45c0dccf5a..f5d944c90a9 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.599 2018/05/28 11:45:26 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.600 2018/06/03 10:17:30 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 28 2018 $ +.Dd $Mdocdate: June 3 2018 $ .Dt TMUX 1 .Os .Sh NAME @@ -3585,7 +3585,8 @@ and .Ql #} , unless they are part of a .Ql #{...} -replacement. For example: +replacement. +For example: .Bd -literal -offset indent #{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W . .Ed |