diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-20 19:40:13 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-20 19:40:13 +0000 |
commit | 846dd76f5940424c60690661ffd74602f74b5051 (patch) | |
tree | 010026608697be4b8db0f1a10b18a8f9fa9ef893 /mdoc_man.c | |
parent | f45f622c8ebfa925e3b5340d31a0b4f9380ff675 (diff) | |
download | mandoc-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_man.c')
-rw-r--r-- | mdoc_man.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -457,7 +457,7 @@ print_offs(const char *v) if (Bl_stack_len) sz += Bl_stack[Bl_stack_len - 1]; - snprintf(buf, sizeof(buf), "%zun", sz); + (void)snprintf(buf, sizeof(buf), "%zun", sz); print_word(buf); outflags |= MMAN_nl; } @@ -510,7 +510,7 @@ print_width(const char *v, const struct mdoc_node *child, size_t defsz) remain = sz + 2; } if (numeric) { - snprintf(buf, sizeof(buf), "%zun", sz + 2); + (void)snprintf(buf, sizeof(buf), "%zun", sz + 2); print_word(buf); } else print_word(v); @@ -520,9 +520,9 @@ print_width(const char *v, const struct mdoc_node *child, size_t defsz) static void print_count(int *count) { - char buf[12]; + char buf[24]; - snprintf(buf, sizeof(buf), "%d.", ++*count); + (void)snprintf(buf, sizeof(buf), "%d.", ++*count); print_word(buf); } @@ -1316,7 +1316,8 @@ mid_it(void) /* Restore the indentation of the enclosing list. */ print_line(".RS", MMAN_Bk_susp); - snprintf(buf, sizeof(buf), "%zun", Bl_stack[Bl_stack_len - 1]); + (void)snprintf(buf, sizeof(buf), "%zun", + Bl_stack[Bl_stack_len - 1]); print_word(buf); /* Remeber to close out this .RS block later. */ |