The previous implementation tried to copy a JSON string value into the
small temporary buffer of 21 bytes if the string was short enough to
fit into the actual data object buffer. The resulted in a buffer overflow.
In addition to that, it's not necessary to copy the string to check if
the buffer is large enough.
This commit fixes the string data object check and avoids the buffer
overflow.
The previous implementation tried to copy a JSON string value into the small temporary buffer of 21 bytes if the string was short enough to fit into the actual data object buffer. The resulted in a buffer overflow.
In addition to that, it's not necessary to copy the string to check if the buffer is large enough.
This commit fixes the string data object check and avoids the buffer overflow.