aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-12-04 00:44:12 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-12-04 00:44:12 +0000
commit7c0b7e474e29ae0b4e927c6d06ad2881e2f95eec (patch)
treedaded8457cd9a70770363a061aaa716956a0c353 /man_html.c
parent0f10c53eb575a6891b9d903803ee9f23251f36fd (diff)
downloadmandoc-7c0b7e474e29ae0b4e927c6d06ad2881e2f95eec.tar.gz
mandoc-7c0b7e474e29ae0b4e927c6d06ad2881e2f95eec.tar.zst
mandoc-7c0b7e474e29ae0b4e927c6d06ad2881e2f95eec.zip
Jumping out of man_unscope() for the root node is a bad idea
because that will skip root node validation, potentially entering rendering modules will NULL pointers lurking in the meta data. Instead, always validate the root node and (as suggested by joerg@) assert validity of the meta data before using it in the renderers. ok joerg@
Diffstat (limited to 'man_html.c')
-rw-r--r--man_html.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/man_html.c b/man_html.c
index 580ef779..fce1d4c5 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.84 2011/11/18 17:05:50 joerg Exp $ */
+/* $Id: man_html.c,v 1.85 2011/12/04 00:44:12 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -178,6 +178,8 @@ print_man_head(MAN_ARGS)
{
print_gen_head(h);
+ assert(m->title);
+ assert(m->msec);
bufcat_fmt(h, "%s(%s)", m->title, m->msec);
print_otag(h, TAG_TITLE, 0, NULL);
print_text(h, h->buf);
@@ -305,8 +307,9 @@ man_root_pre(MAN_ARGS)
if (m->vol)
(void)strlcat(b, m->vol, BUFSIZ);
- snprintf(title, BUFSIZ - 1, "%s(%s)", m->title ? m->title : "",
- m->msec ? m->msec : "");
+ assert(m->title);
+ assert(m->msec);
+ snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec);
PAIR_SUMMARY_INIT(&tag[0], "Document Header");
PAIR_CLASS_INIT(&tag[1], "head");
@@ -360,8 +363,8 @@ man_root_post(MAN_ARGS)
PAIR_CLASS_INIT(&tag[0], "foot-date");
print_otag(h, TAG_TD, 1, tag);
- if (m->date)
- print_text(h, m->date);
+ assert(m->date);
+ print_text(h, m->date);
print_stagq(h, tt);
PAIR_CLASS_INIT(&tag[0], "foot-os");