valuetest: fix potential write of terminating nul past the end of the destination
Fixes 2 compile errors with gcc-12, eg: tesunittest/valuetest.cpp:1516:30: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=] test/unittest/valuetest.cpp:1516:20: note: 'sprintf' output between 2 and 11 bytes into a destination of size 10
This commit is contained in:
parent
fcb23c2dbf
commit
1f59c69cd1
@ -1581,7 +1581,7 @@ TEST(Value, ObjectHelperRangeFor) {
|
||||
{
|
||||
int i = 0;
|
||||
for (auto& m : x.GetObject()) {
|
||||
char name[10];
|
||||
char name[11];
|
||||
sprintf(name, "%d", i);
|
||||
EXPECT_STREQ(name, m.name.GetString());
|
||||
EXPECT_EQ(i, m.value.GetInt());
|
||||
@ -1592,7 +1592,7 @@ TEST(Value, ObjectHelperRangeFor) {
|
||||
{
|
||||
int i = 0;
|
||||
for (const auto& m : const_cast<const Value&>(x).GetObject()) {
|
||||
char name[10];
|
||||
char name[11];
|
||||
sprintf(name, "%d", i);
|
||||
EXPECT_STREQ(name, m.name.GetString());
|
||||
EXPECT_EQ(i, m.value.GetInt());
|
||||
|
Loading…
x
Reference in New Issue
Block a user