summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-03-15 16:51:34 +0000
committerschwarze <schwarze@openbsd.org>2015-03-15 16:51:34 +0000
commit710eed9448dc5a23adf729dbedbeef961fd9a09d (patch)
tree32521d50c9231db464c172c6a9a6a14bc9a7871b
parentfrom zhuk: remove ambiguity around the false/true description; (diff)
downloadwireguard-openbsd-710eed9448dc5a23adf729dbedbeef961fd9a09d.tar.xz
wireguard-openbsd-710eed9448dc5a23adf729dbedbeef961fd9a09d.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--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 56cfc03c7d5..de80db0f6e0 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_term.c,v 1.122 2015/03/09 17:41:36 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.123 2015/03/15 16:51:34 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -741,7 +741,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;