From: Pádraig Brady Date: Wed, 11 Jun 2014 23:35:14 +0000 (+0100) Subject: maint: suppress a theoretical buffer overflow warning X-Git-Tag: v8.23~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f169fe49bc6788cd1d5e5cce84b41d40f053d5f;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/src/numfmt.c b/src/numfmt.c index e8f53fc3f7..6091bb6bd5 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");