summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-20 19:40:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-20 19:40:13 +0000
commit846dd76f5940424c60690661ffd74602f74b5051 (patch)
tree010026608697be4b8db0f1a10b18a8f9fa9ef893 /mdoc_validate.c
parentf45f622c8ebfa925e3b5340d31a0b4f9380ff675 (diff)
downloadmandoc-846dd76f5940424c60690661ffd74602f74b5051.tar.gz
make sure static buffers for snprintf(3) are large enough
and cast snprintf return value to (void) where they are
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index b604fa5c..fb7863ec 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -45,8 +45,6 @@
#define PRE_ARGS struct mdoc *mdoc, struct mdoc_node *n
#define POST_ARGS struct mdoc *mdoc
-#define NUMSIZ 32
-
enum check_ineq {
CHECK_LT,
CHECK_GT,
@@ -1388,7 +1386,7 @@ post_bl_block_width(POST_ARGS)
int i;
enum mdoct tok;
struct mdoc_node *n;
- char buf[NUMSIZ];
+ char buf[24];
n = mdoc->last;
@@ -1420,7 +1418,7 @@ post_bl_block_width(POST_ARGS)
assert(i < (int)n->args->argc);
- snprintf(buf, NUMSIZ, "%un", (unsigned int)width);
+ (void)snprintf(buf, sizeof(buf), "%un", (unsigned int)width);
free(n->args->argv[i].value[0]);
n->args->argv[i].value[0] = mandoc_strdup(buf);
@@ -1435,7 +1433,7 @@ post_bl_block_tag(POST_ARGS)
struct mdoc_node *n, *nn;
size_t sz, ssz;
int i;
- char buf[NUMSIZ];
+ char buf[24];
/*
* Calculate the -width for a `Bl -tag' list if it hasn't been
@@ -1470,7 +1468,7 @@ post_bl_block_tag(POST_ARGS)
/* Defaults to ten ens. */
- snprintf(buf, NUMSIZ, "%un", (unsigned int)sz);
+ (void)snprintf(buf, sizeof(buf), "%un", (unsigned int)sz);
/*
* We have to dynamically add this to the macro's argument list.