=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.264 retrieving revision 1.266 diff -u -p -r1.264 -r1.266 --- mandoc/mdoc_term.c 2014/04/20 16:46:05 1.264 +++ mandoc/mdoc_term.c 2014/04/20 20:18:12 1.266 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.264 2014/04/20 16:46:05 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.266 2014/04/20 20:18:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze @@ -30,6 +30,7 @@ #include #include "mandoc.h" +#include "mandoc_aux.h" #include "out.h" #include "term.h" #include "mdoc.h" @@ -441,9 +442,10 @@ print_mdoc_foot(struct termp *p, const void *arg) static void print_mdoc_head(struct termp *p, const void *arg) { - char buf[BUFSIZ], title[BUFSIZ]; - size_t buflen, titlen; - const struct mdoc_meta *meta; + char buf[BUFSIZ]; + const struct mdoc_meta *meta; + char *title; + size_t buflen, titlen; meta = (const struct mdoc_meta *)arg; @@ -473,7 +475,7 @@ print_mdoc_head(struct termp *p, const void *arg) strlcat(buf, ")", BUFSIZ); } - snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec); + mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); titlen = term_strlen(p, title); p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; @@ -508,6 +510,7 @@ print_mdoc_head(struct termp *p, const void *arg) p->flags &= ~TERMP_NOSPACE; p->offset = 0; p->rmargin = p->maxrmargin; + free(title); } static size_t @@ -620,7 +623,7 @@ static int termp_it_pre(DECL_ARGS) { const struct mdoc_node *bl, *nn; - char buf[7]; + char buf[24]; int i; size_t width, offset, ncols, dcol; enum mdoc_list type; @@ -916,7 +919,7 @@ termp_it_pre(DECL_ARGS) break; case LIST_enum: (pair->ppair->ppair->count)++; - snprintf(buf, sizeof(buf), "%d.", + (void)snprintf(buf, sizeof(buf), "%d.", pair->ppair->ppair->count); term_word(p, buf); break;