From c0c47ffe49a70fb77831194f625f593bd29c449e Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 20 Apr 2014 19:40:13 +0000 Subject: make sure static buffers for snprintf(3) are large enough and cast snprintf return value to (void) where they are --- mdoc_man.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mdoc_man.c') 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 * @@ -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. */ -- cgit v1.2.3