From 3ee436ab2a46363611bf798816b6330a09d9b68e Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 20 Apr 2015 09:48:53 +0000 Subject: Avoid out-of-bounds read access before the beginning of the mdoc_macros[] array. This sometimes prevented proper warnings about text nodes preceding the first section header. --- mdoc_validate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index dd477eef..616e9b10 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1562,7 +1562,8 @@ post_root(POST_ARGS) /* Check that we begin with a proper `Sh'. */ n = mdoc->first->child; - while (n != NULL && mdoc_macros[n->tok].flags & MDOC_PROLOGUE) + while (n != NULL && n->tok != TOKEN_NONE && + mdoc_macros[n->tok].flags & MDOC_PROLOGUE) n = n->next; if (n == NULL) -- cgit