diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-20 20:18:12 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-20 20:18:12 +0000 |
commit | 0e671b23106993a04ea9629722c1308693db3523 (patch) | |
tree | 349486bf660b15ebf9ca04fe31b0617fcfa8bd95 /man_html.c | |
parent | 846dd76f5940424c60690661ffd74602f74b5051 (diff) | |
download | mandoc-0e671b23106993a04ea9629722c1308693db3523.tar.gz |
fix unchecked snprintf(3) in page header printing:
the length of the title is unknown, and speed doesn't matter here,
so use asprintf/free rather than a static buffer
Diffstat (limited to 'man_html.c')
-rw-r--r-- | man_html.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -28,6 +28,7 @@ #include <string.h> #include "mandoc.h" +#include "mandoc_aux.h" #include "out.h" #include "html.h" #include "man.h" @@ -300,9 +301,10 @@ a2width(const struct man_node *n, struct roffsu *su) static void man_root_pre(MAN_ARGS) { + char b[BUFSIZ]; struct htmlpair tag[3]; struct tag *t, *tt; - char b[BUFSIZ], title[BUFSIZ]; + char *title; b[0] = 0; if (man->vol) @@ -310,7 +312,7 @@ man_root_pre(MAN_ARGS) assert(man->title); assert(man->msec); - snprintf(title, BUFSIZ - 1, "%s(%s)", man->title, man->msec); + mandoc_asprintf(&title, "%s(%s)", man->title, man->msec); PAIR_SUMMARY_INIT(&tag[0], "Document Header"); PAIR_CLASS_INIT(&tag[1], "head"); @@ -341,6 +343,7 @@ man_root_pre(MAN_ARGS) print_otag(h, TAG_TD, 2, tag); print_text(h, title); print_tagq(h, t); + free(title); } static void |