Support NUL inside string values (issue #1646)

This commit is contained in:
Benoit Blanchon
2021-11-21 15:07:56 +01:00
parent a27398e445
commit be70f6ddd7
22 changed files with 144 additions and 59 deletions

View File

@@ -78,9 +78,11 @@ class MsgPackSerializer : public Visitor<size_t> {
}
size_t visitString(const char* value) {
ARDUINOJSON_ASSERT(value != NULL);
return visitString(value, strlen(value));
}
size_t n = strlen(value);
size_t visitString(const char* value, size_t n) {
ARDUINOJSON_ASSERT(value != NULL);
if (n < 0x20) {
writeByte(uint8_t(0xA0 + n));