summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-04-20 19:39:35 +0000
committerschwarze <schwarze@openbsd.org>2014-04-20 19:39:35 +0000
commit478131463a63046a582b3c8d04d5773b4128be7e (patch)
tree75c2b6ccec6e8b8d830845010d843787808d90ef /usr.bin/mandoc/mdoc_man.c
parentRemove unused/never installed libssl tools and docs and references to them (diff)
downloadwireguard-openbsd-478131463a63046a582b3c8d04d5773b4128be7e.tar.xz
wireguard-openbsd-478131463a63046a582b3c8d04d5773b4128be7e.zip
make sure static buffers for snprintf(3) are large enough
and cast snprintf return value to (void) where they are
Diffstat (limited to 'usr.bin/mandoc/mdoc_man.c')
-rw-r--r--usr.bin/mandoc/mdoc_man.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 979926a5371..813a28a2b6a 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.61 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.62 2014/04/20 19:39:35 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -453,7 +453,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;
}
@@ -506,7 +506,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);
@@ -516,9 +516,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);
}
@@ -1312,7 +1312,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. */