diff options
author | 2014-11-25 03:04:32 +0000 | |
---|---|---|
committer | 2014-11-25 03:04:32 +0000 | |
commit | 7fa9bcfab8a9781a3a93c10c15efe15efb60351c (patch) | |
tree | 4c0f84ac6aa0957a628d2dee859e125a9a88813f /usr.bin/mandoc/mdoc_macro.c | |
parent | push some global data down into functions to make this threadlier. (diff) | |
download | wireguard-openbsd-7fa9bcfab8a9781a3a93c10c15efe15efb60351c.tar.xz wireguard-openbsd-7fa9bcfab8a9781a3a93c10c15efe15efb60351c.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 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 6c584c54def..f26a6a384e0 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.101 2014/11/20 00:30:34 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.102 2014/11/25 03:04:32 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -435,9 +435,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); |