summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.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_html.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_html.c')
-rw-r--r--usr.bin/mandoc/mdoc_html.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 80575e0b236..339eb9917e4 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.98 2015/02/05 01:46:38 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.99 2015/02/11 14:14:53 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -2218,9 +2218,8 @@ mdoc_eo_pre(MDOC_ARGS)
n->child->end != ENDBODY_NOT)
print_text(h, "\\&");
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)))
h->flags |= HTML_NOSPACE;
return(1);
}