From e097222e645cb8d6441d0227faad01882674afbb Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 13 Dec 2016 18:33:21 -0800 Subject: [PATCH] util/logging.cc: buffer of insufficient size (gcc-7 -Werror=format-length) Summary: util/logging.cc:100:13: error: output may be truncated before the last format character [-Werror=format-length=] std::string NumberToHumanString(int64_t num) { ^~~~~~~~~~~~~~~~~~~ util/logging.cc:106:59: note: format output between 3 and 19 bytes into a destination of size 16 snprintf(buf, sizeof(buf), "%" PRIi64 "K", num / 1000); Closes https://github.com/facebook/rocksdb/pull/1653 Differential Revision: D4318687 Pulled By: yiwu-arbug fbshipit-source-id: 3a5c931 --- util/logging.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/logging.cc b/util/logging.cc index 2e0881bb5..298a7cf33 100644 --- a/util/logging.cc +++ b/util/logging.cc @@ -98,7 +98,7 @@ std::string NumberToString(uint64_t num) { } std::string NumberToHumanString(int64_t num) { - char buf[16]; + char buf[19]; int64_t absnum = num < 0 ? -num : num; if (absnum < 10000) { snprintf(buf, sizeof(buf), "%" PRIi64, num);