summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-09-20 13:13:21 +0000
committerschwarze <schwarze@openbsd.org>2011-09-20 13:13:21 +0000
commitc122a6de22c201ac6b17a7d15434aeceb6a8c83e (patch)
tree532223148c52bbccdcd146134222eeba9b08c660
parentLose unused variable cvs_msg, from Michael W Bombardieri. (diff)
downloadwireguard-openbsd-c122a6de22c201ac6b17a7d15434aeceb6a8c83e.tar.xz
wireguard-openbsd-c122a6de22c201ac6b17a7d15434aeceb6a8c83e.zip
When advancing the left margin, .RS also needs to reset the right margin
to the default and check that the left does not outgrow the right one. Otherwise, the (rmargin >= offset) assertion fails in term_flushln(). Bug found and fix tested by kristaps@ with NetBSD slapo-retcode(5).
-rw-r--r--usr.bin/mandoc/man_term.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 1e63899fa17..b9e0113521b 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.73 2011/09/20 09:02:18 schwarze Exp $ */
+/* $Id: man_term.c,v 1.74 2011/09/20 13:13:21 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -822,7 +822,8 @@ pre_RS(DECL_ARGS)
sz = (size_t)ival;
mt->offset += sz;
- p->offset = mt->offset;
+ p->rmargin = p->maxrmargin;
+ p->offset = mt->offset < p->rmargin ? mt->offset : p->rmargin;
if (++mt->lmarginsz < MAXMARGINS)
mt->lmargincur = mt->lmarginsz;