aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-17 12:10:16 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-17 12:10:16 +0000
commitc419530b09693aaf29ca6cc737b77f6c35089c21 (patch)
treea483547cbe3418091a867796ddf51c22b46b3ddc /mdoc_html.c
parent2cfc7310afb5b9fc57aba0d72188cc20f947c244 (diff)
downloadmandoc-c419530b09693aaf29ca6cc737b77f6c35089c21.tar.gz
mandoc-c419530b09693aaf29ca6cc737b77f6c35089c21.tar.zst
mandoc-c419530b09693aaf29ca6cc737b77f6c35089c21.zip
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@
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 0f71a16b..27ca1a49 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.277 2017/03/15 11:29:53 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.278 2017/03/17 12:10:16 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}