From 1a9de881175a9ce1713fec967bbf921de4ef1fd4 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 7 Nov 2019 08:00:21 +0100 Subject: [PATCH] :rotating_light: fix a linter warning Coverity detected two "Memory - illegal accesses (OVERRUN)" issues. Resizing the buffer should silence this warning. --- test/src/unit-to_chars.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/unit-to_chars.cpp b/test/src/unit-to_chars.cpp index 6ff5cd10..5047fd1a 100644 --- a/test/src/unit-to_chars.cpp +++ b/test/src/unit-to_chars.cpp @@ -359,7 +359,7 @@ TEST_CASE("formatting") { auto check_float = [](float number, const std::string & expected) { - char buf[32]; + char buf[33]; char* end = nlohmann::detail::to_chars(buf, buf + 32, number); std::string actual(buf, end); @@ -419,7 +419,7 @@ TEST_CASE("formatting") { auto check_double = [](double number, const std::string & expected) { - char buf[32]; + char buf[33]; char* end = nlohmann::detail::to_chars(buf, buf + 32, number); std::string actual(buf, end);