aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_man.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
commitc0c47ffe49a70fb77831194f625f593bd29c449e (patch)
treedb8c1dbd3c3052a39baeff9ada43ecce15282496 /mdoc_man.c
parent29cecee7ff6894517a32d929aecee283bb85058c (diff)
downloadmandoc-c0c47ffe49a70fb77831194f625f593bd29c449e.tar.gz
mandoc-c0c47ffe49a70fb77831194f625f593bd29c449e.tar.zst
mandoc-c0c47ffe49a70fb77831194f625f593bd29c449e.zip
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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 626933f5..29bede8f 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.62 2014/04/20 16:46:05 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.63 2014/04/20 19:40:13 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -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. */