aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-03-15 16:53:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-03-15 16:53:41 +0000
commitc7e9eaf82d8a0689a69d341a31f3ba3206e20bc3 (patch)
tree83f55242658757863eae69bdd7d3286fa85631b7
parent57952d3568fc684859e0e7a04e942d11736c1792 (diff)
downloadmandoc-c7e9eaf82d8a0689a69d341a31f3ba3206e20bc3.tar.gz
mandoc-c7e9eaf82d8a0689a69d341a31f3ba3206e20bc3.tar.zst
mandoc-c7e9eaf82d8a0689a69d341a31f3ba3206e20bc3.zip
Avoid off-by-one read access to the termacts array, which could
sometimes result in missing line breaks before subsection headers. Found by carsten dot kunze at arcor dot de on SuSE 13.2.
-rw-r--r--man_term.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/man_term.c b/man_term.c
index 8be7927a..ad007c8c 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.169 2015/03/06 15:48:52 schwarze Exp $ */
+/* $Id: man_term.c,v 1.170 2015/03/15 16:53:41 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -743,7 +743,8 @@ pre_SS(DECL_ARGS)
do {
n = n->prev;
- } while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT);
+ } while (n != NULL && n->tok != MAN_MAX &&
+ termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
break;