summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-11 14:14:54 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-02-11 14:14:54 +0000
commit43978811757382c489f9508a0006eac2a32069c7 (patch)
tree1fc922fb4bc88fc63b89943b9a6f0ee272b944de /usr.bin/mandoc
parentea5ad85f404c0e109ec15e99fc47f0c32c3de0cf (diff)
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')
-rw-r--r--usr.bin/mandoc/mdoc_html.c7
-rw-r--r--usr.bin/mandoc/mdoc_man.c7
-rw-r--r--usr.bin/mandoc/mdoc_term.c7
3 files changed, 9 insertions, 12 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);
}
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);
}
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 2434d19193e..d801804ad01 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.207 2015/02/05 01:46:38 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.208 2015/02/11 14:14:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1987,9 +1987,8 @@ termp_eo_pre(DECL_ARGS)
n->child->end != ENDBODY_NOT)
term_word(p, "\\&");
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)))
p->flags |= TERMP_NOSPACE;
return(1);