🚨 fix a linter warning
Coverity detected two "Memory - illegal accesses (OVERRUN)" issues. Resizing the buffer should silence this warning.
This commit is contained in:
1 file changed
+2
-2
@@ -359,7 +359,7 @@ TEST_CASE("formatting")
|
|||||||
{
|
{
|
||||||
auto check_float = [](float number, const std::string & expected)
|
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);
|
char* end = nlohmann::detail::to_chars(buf, buf + 32, number);
|
||||||
std::string actual(buf, end);
|
std::string actual(buf, end);
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ TEST_CASE("formatting")
|
|||||||
{
|
{
|
||||||
auto check_double = [](double number, const std::string & expected)
|
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);
|
char* end = nlohmann::detail::to_chars(buf, buf + 32, number);
|
||||||
std::string actual(buf, end);
|
std::string actual(buf, end);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user