diff options
author | 2017-02-11 21:49:50 +0000 | |
---|---|---|
committer | 2017-02-11 21:49:50 +0000 | |
commit | 751954a95b11620a0729815eee5feeaa166a265c (patch) | |
tree | bea7697eca75fdd5bc4181edacebcd1044cccca9 /man_term.c | |
parent | d239cb85c79395e48ba21125d4726cd6b9325606 (diff) | |
download | mandoc-751954a95b11620a0729815eee5feeaa166a265c.tar.gz mandoc-751954a95b11620a0729815eee5feeaa166a265c.tar.zst mandoc-751954a95b11620a0729815eee5feeaa166a265c.zip |
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...
Diffstat (limited to 'man_term.c')
-rw-r--r-- | man_term.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.189 2017/02/04 11:58:09 schwarze Exp $ */ +/* $Id: man_term.c,v 1.190 2017/02/11 21:49:50 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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; |