summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-11 21:49:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-11 21:49:50 +0000
commit569cfcee61560d07f2e68e68d200da64b2c10f7e (patch)
treeda2bf1d321bebdd944e538c933c671059419ff9e
parenta81736faf5784c97e7a57a87da2da19e17539316 (diff)
downloadmandoc-569cfcee61560d07f2e68e68d200da64b2c10f7e.tar.gz
Do not read one element past the end of the static const termacts array.
Bug found by Sevan Janiyan <venture37 at geeklan dot co dot uk> who ran the OpenBSD mandoc test suite on Ubuntu on POWER8 (sic!) and reported that mdoc/Sh/before.in failed in -Tman mode. If that isn't power testing, i don't know...
-rw-r--r--man_term.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/man_term.c b/man_term.c
index e4f106b9..a2f32c7e 100644
--- a/man_term.c
+++ b/man_term.c
@@ -822,7 +822,8 @@ pre_SH(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_SH && n->body->child == NULL))
break;