aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_state.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-30 18:53:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-30 18:53:54 +0000
commit86f7c723953672d317bade10fa45e919e6bec8ff (patch)
treeafece3a47cfe275f7a7d57dc21fa772fcec98432 /mdoc_state.c
parent912db4b9792932105125cf0fbe472c889551fcfd (diff)
downloadmandoc-86f7c723953672d317bade10fa45e919e6bec8ff.tar.gz
mandoc-86f7c723953672d317bade10fa45e919e6bec8ff.tar.zst
mandoc-86f7c723953672d317bade10fa45e919e6bec8ff.zip
Do not access a NULL pointer when a .Bd macro has no arguments at all.
Bug reported by krw@.
Diffstat (limited to 'mdoc_state.c')
-rw-r--r--mdoc_state.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mdoc_state.c b/mdoc_state.c
index 7fc76dcb..cbd73763 100644
--- a/mdoc_state.c
+++ b/mdoc_state.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_state.c,v 1.2 2015/10/21 23:51:11 schwarze Exp $ */
+/* $Id: mdoc_state.c,v 1.3 2015/10/30 18:53:54 schwarze Exp $ */
/*
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -195,6 +195,9 @@ state_bd(STATE_ARGS)
(n->type != ROFFT_BODY || n->end != ENDBODY_NOT))
return;
+ if (n->parent->args == NULL)
+ return;
+
arg = n->parent->args->argv[0].arg;
if (arg != MDOC_Literal && arg != MDOC_Unfilled)
return;