summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-11 13:37:32 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-11 13:37:32 +0000
commitea5ad85f404c0e109ec15e99fc47f0c32c3de0cf (patch)
tree152abbf61a569529fceca27adf7490e1c47a593a /usr.bin/mandoc
parentec388ea6e7a0a7060e001fdf2d679464d043b51d (diff)
explicit blocks close out .Nd; fixing data structure corruption
eventually leading to NULL pointer access; found by jsg@ with afl, text case #455.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mdoc_macro.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index dc36316a99a..8ff01cabd9f 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.137 2015/02/10 17:47:19 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.138 2015/02/11 13:37:31 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -628,6 +628,13 @@ blk_exp_close(MACRO_PROT_ARGS)
break;
}
+ /* Explicit blocks close out description lines. */
+
+ if (n->tok == MDOC_Nd) {
+ rew_last(mdoc, n);
+ continue;
+ }
+
/*
* When finding an open sub block, remember the last
* open explicit block, or, in case there are only