aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-25 20:00:01 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-25 20:00:01 +0000
commitb6eb32baf4f92507017b1af5af22cec2aed378ee (patch)
treef977905f85d4081796e4e7e2d54b4e1417a0fbcb /mdoc_macro.c
parent6242a9efa48427465988912bdb7e56c75b239acf (diff)
downloadmandoc-b6eb32baf4f92507017b1af5af22cec2aed378ee.tar.gz
mandoc-b6eb32baf4f92507017b1af5af22cec2aed378ee.tar.zst
mandoc-b6eb32baf4f92507017b1af5af22cec2aed378ee.zip
Do not access a NULL pointer when a section has no body,
which can for example happen for .Sh Xo .Sh without .Xc. Crash found by jsg@ with afl.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index d4339670..eaab43bf 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.145 2014/11/20 00:31:28 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.146 2014/11/25 20:00:01 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -437,9 +437,11 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
* Default block rewinding rules.
* In particular, always skip block end markers,
* and let all blocks rewind Nm children.
+ * Do not warn again when closing a block,
+ * since closing the body already warned.
*/
if (ENDBODY_NOT != p->end || MDOC_Nm == p->tok ||
- (MDOC_BLOCK == p->type &&
+ MDOC_BLOCK == type || (MDOC_BLOCK == p->type &&
! (MDOC_EXPLICIT & mdoc_macros[tok].flags)))
return(REWIND_MORE);