From 4f169fe49bc6788cd1d5e5cce84b41d40f053d5f Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Thu, 12 Jun 2014 00:35:14 +0100 Subject: maint: suppress a theoretical buffer overflow warning * src/numfmt.c (double_to_human): The printf format is built up in a stack buffer which is big enough to hold any of the possible formats. However the size parameter passed to snprintf was too big by 1 when GROUP was true. So decrease the buffer available to snprintf to avoid this theoretical in practise but valid coverity warning. --- src/numfmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/numfmt.c b/src/numfmt.c index e8f53fc3f..6091bb6bd 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -703,7 +703,7 @@ double_to_human (long double val, int precision, *pfmt++ = '\''; if (zero_padding_width) - pfmt += snprintf (pfmt, sizeof (fmt) - 1, "0%ld", zero_padding_width); + pfmt += snprintf (pfmt, sizeof (fmt) - 2, "0%ld", zero_padding_width); devmsg ("double_to_human:\n"); -- cgit v1.2.3-70-g09d2