From: elene-margalit Date: Mon, 31 Aug 2020 10:19:02 +0000 (+0200) Subject: Changed buffer size in function format_metric_distribution. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fad7a03d28f70a7a7cddea5858c8b98f25bd33f4;p=thirdparty%2Fcollectd.git Changed buffer size in function format_metric_distribution. --- diff --git a/src/utils/format_json/format_json.c b/src/utils/format_json/format_json.c index 72a5309a2..6c9754ccd 100644 --- a/src/utils/format_json/format_json.c +++ b/src/utils/format_json/format_json.c @@ -125,12 +125,12 @@ static int format_metric_distribution(strbuf_t buf, yajl_gen g, for (size_t i = 0; i < buckets.num_buckets; i++) { double max = buckets.buckets[i].maximum; - char max_char[sizeof(max)]; - snprintf(max_char, sizeof(max), "%.2f", max); + char max_char[32]; + ssnprintf(max_char, sizeof(max_char), "%.2f", max); uint64_t bucket_counter = buckets.buckets[i].bucket_counter; - char counter_char[sizeof(bucket_counter)]; - snprintf(counter_char, sizeof(bucket_counter), "%" PRIu64, bucket_counter); + char counter_char[32]; + ssnprintf(counter_char, sizeof(bucket_counter), "%" PRIu64, bucket_counter); CHECK(json_add_string(g, max_char)); CHECK(json_add_string(g, counter_char)); }