]> git.cameronkatri.com Git - mandoc.git/commitdiff
Fix regression in mdoc_html.c 1.275, man_html 1.134:
authorIngo Schwarze <schwarze@openbsd.org>
Fri, 17 Mar 2017 12:10:16 +0000 (12:10 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Fri, 17 Mar 2017 12:10:16 +0000 (12:10 +0000)
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@

man_html.c
mdoc_html.c

index 10c544f993e52e771d6a5169962ec5dbab6e0735..ede0a43b77a3d772d3b733cca2159b6e85f0e509 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: man_html.c,v 1.134 2017/03/15 11:29:53 schwarze Exp $ */
+/*     $Id: man_html.c,v 1.135 2017/03/17 12:10:16 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
index 0f71a16b0f5403e9011f437773ecce25eb43f829..27ca1a49701fa50a1a859ca05f627301394a9773 100644 (file)
@@ -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;
 }