summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-11-16 17:21:15 +0000
committerschwarze <schwarze@openbsd.org>2011-11-16 17:21:15 +0000
commit896fb37a646b42192d47dccff34ff70b3a2bf097 (patch)
treee7a52defc76349db56ed391e499f90b6b7114e8d /usr.bin/mandoc/man.c
parentDuring pkg_create(1), do not print any warnings or non-fatal errors (diff)
downloadwireguard-openbsd-896fb37a646b42192d47dccff34ff70b3a2bf097.tar.xz
wireguard-openbsd-896fb37a646b42192d47dccff34ff70b3a2bf097.zip
When a .TP block is broken but already contains a head element,
do not abort(), but delete the head together with the block itself. Problem found and patch provided by joerg@, thanks!
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r--usr.bin/mandoc/man.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 01f233add1d..42d44a0911e 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.63 2011/11/05 16:02:18 schwarze Exp $ */
+/* $Id: man.c,v 1.64 2011/11/16 17:21:15 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -552,10 +552,15 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
if ((m->flags & MAN_BLINE) &&
(MAN_BSCOPE & man_macros[tok].flags)) {
n = m->last;
- assert(MAN_TEXT != n->type);
- /* Remove element that didn't end BLINE, if any. */
+ /* Might be a text node like 8 in
+ * .TP 8
+ * .SH foo
+ */
+ if (MAN_TEXT == n->type)
+ n = n->parent;
+ /* Remove element that didn't end BLINE, if any. */
if ( ! (MAN_BSCOPE & man_macros[n->tok].flags))
n = n->parent;