summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-06-12 00:35:14 +0100
committerPádraig Brady <P@draigBrady.com>2014-06-12 00:39:13 +0100
commit4f169fe49bc6788cd1d5e5cce84b41d40f053d5f (patch)
tree0579c51162a9792fdaab442b500cc09439b408d0 /src
parente919da5aee779358bab7def14c77049546811750 (diff)
downloadcoreutils-4f169fe49bc6788cd1d5e5cce84b41d40f053d5f.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/numfmt.c2
1 files changed, 1 insertions, 1 deletions
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");