summaryrefslogtreecommitdiffstats
path: root/read.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-04-03 10:11:25 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-04-03 10:11:25 +0000
commit33c7bf866c059d2de7824023b724ed7c05fb684f (patch)
tree2b9a56399458c0e9e77d67fbca97b9c9e0f149b1 /read.c
parent30823ed848f6fdfe70dedc3207ffad3e075dc51a (diff)
downloadmandoc-33c7bf866c059d2de7824023b724ed7c05fb684f.tar.gz
If wlevel in mparse_alloc() is greater than MANDOCLEVEL_FATAL, we'll
throw assertions due to per-file-error not being properly set in mmsg(). This is reasonable behaviour (we shouldn't be able to ignore FATAL after all). Thus, make sure wlevel is sanitised.
Diffstat (limited to 'read.c')
-rw-r--r--read.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/read.c b/read.c
index ac0b23be..9c222eb1 100644
--- a/read.c
+++ b/read.c
@@ -662,6 +662,8 @@ mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, mandocmsg mmsg, void
{
struct mparse *curp;
+ assert(wlevel <= MANDOCLEVEL_FATAL);
+
curp = mandoc_calloc(1, sizeof(struct mparse));
curp->wlevel = wlevel;