Fixed null values that could be pass to strcmp() (closes #745)

This commit is contained in:
Benoit Blanchon
2018-06-01 09:08:38 +02:00
parent 3523296e3d
commit 7c0af91844
9 changed files with 75 additions and 16 deletions

View File

@ -149,4 +149,15 @@ TEST_CASE("JsonObject::operator[]") {
const size_t expectedSize = JSON_OBJECT_SIZE(1) + 12;
REQUIRE(expectedSize <= _jsonBuffer.size());
}
SECTION("should ignore null key") {
// object must have a value to make a call to strcmp()
_object["dummy"] = 42;
const char* null = 0;
_object[null] = 666;
REQUIRE(_object.size() == 1);
REQUIRE(_object[null] == 0);
}
}