diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-20 09:48:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-20 09:48:53 +0000 |
commit | 327ba4d7676807137f3ba3026d1d55f0b17a9bfd (patch) | |
tree | 6167826ae4841dd0fc822c89f2462b680901e065 | |
parent | b3c6910297c5c3ac3a504ac3e46fe4df7c5c7ad2 (diff) | |
download | mandoc-327ba4d7676807137f3ba3026d1d55f0b17a9bfd.tar.gz mandoc-327ba4d7676807137f3ba3026d1d55f0b17a9bfd.tar.zst mandoc-327ba4d7676807137f3ba3026d1d55f0b17a9bfd.zip |
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.
-rw-r--r-- | mdoc_validate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 1df68760..272c23aa 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.289 2015/04/19 14:25:41 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.290 2015/04/20 09:48:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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) |