diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-03-17 12:10:16 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-03-17 12:10:16 +0000 |
commit | 6f690198d639784695f202701c693bd56db57eb7 (patch) | |
tree | 156371d71a054c6641858613bb5fd7ab0ee8f2e2 | |
parent | 0f790e66e278261421be6bb2b1285564f929469a (diff) | |
download | mandoc-6f690198d639784695f202701c693bd56db57eb7.tar.gz |
Fix regression in mdoc_html.c 1.275, man_html 1.134:
For .Sh, .Ss, .SH, .SS, only write selflink if an id could be constructed.
Crash reported by Raf Czlonka <rczlonka at gmail dot com>,
analysis of root cause by natano@
-rw-r--r-- | man_html.c | 6 | ||||
-rw-r--r-- | mdoc_html.c | 6 |
2 files changed, 8 insertions, 4 deletions
@@ -440,7 +440,8 @@ man_SH_pre(MAN_ARGS) if (n->type == ROFFT_HEAD) { id = html_make_id(n); print_otag(h, TAG_H1, "cTi", "Sh", id); - print_otag(h, TAG_A, "chR", "selflink", id); + if (id != NULL) + print_otag(h, TAG_A, "chR", "selflink", id); free(id); } return 1; @@ -509,7 +510,8 @@ man_SS_pre(MAN_ARGS) if (n->type == ROFFT_HEAD) { id = html_make_id(n); print_otag(h, TAG_H2, "cTi", "Ss", id); - print_otag(h, TAG_A, "chR", "selflink", id); + if (id != NULL) + print_otag(h, TAG_A, "chR", "selflink", id); free(id); } return 1; diff --git a/mdoc_html.c b/mdoc_html.c index eda5ce41..6987525c 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -501,7 +501,8 @@ mdoc_sh_pre(MDOC_ARGS) case ROFFT_HEAD: id = html_make_id(n); print_otag(h, TAG_H1, "cTi", "Sh", id); - print_otag(h, TAG_A, "chR", "selflink", id); + if (id != NULL) + print_otag(h, TAG_A, "chR", "selflink", id); free(id); break; case ROFFT_BODY: @@ -524,7 +525,8 @@ mdoc_ss_pre(MDOC_ARGS) id = html_make_id(n); print_otag(h, TAG_H2, "cTi", "Ss", id); - print_otag(h, TAG_A, "chR", "selflink", id); + if (id != NULL) + print_otag(h, TAG_A, "chR", "selflink", id); free(id); return 1; } |