summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-02-11 14:14:53 +0000
committerschwarze <schwarze@openbsd.org>2015-02-11 14:14:53 +0000
commitc69b5c3793dd01abee94180b56ba5edc61f16195 (patch)
treef4538fa729c866e1cbd8afa8b3df64424b884d42 /usr.bin/mandoc/mdoc_man.c
parentexplicit blocks close out .Nd; fixing data structure corruption (diff)
downloadwireguard-openbsd-c69b5c3793dd01abee94180b56ba5edc61f16195.tar.xz
wireguard-openbsd-c69b5c3793dd01abee94180b56ba5edc61f16195.zip
do not access a NULL pointer if an .Eo block lacks a tail;
found by jsg@ with afl, test case #16
Diffstat (limited to 'usr.bin/mandoc/mdoc_man.c')
-rw-r--r--usr.bin/mandoc/mdoc_man.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 07553485220..906b99fdbac 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_man.c,v 1.83 2015/02/06 03:31:11 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.84 2015/02/11 14:14:53 schwarze Exp $ */
/*
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -1138,9 +1138,8 @@ pre_eo(DECL_ARGS)
n->child->end != ENDBODY_NOT)
print_word("\\&");
else if (n->end != ENDBODY_NOT ? n->child != NULL :
- n->parent->head->child != NULL &&
- (n->parent->body->child != NULL ||
- n->parent->tail->child != NULL))
+ n->parent->head->child != NULL && (n->child != NULL ||
+ (n->parent->tail != NULL && n->parent->tail->child != NULL)))
outflags &= ~(MMAN_spc | MMAN_nl);
return(1);
}