Fix possible output corruption in rjson

Was possible when translation service was adding a base64 encoded string with a length less than 1536 characters.
Introduced in commit c20b01e9e1.
This commit is contained in:
Bernhard Schelling 2020-10-26 10:44:04 +09:00 committed by GitHub
parent c20b01e9e1
commit cc1937a3af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1303,7 +1303,7 @@ void rjsonwriter_raw(rjsonwriter_t *writer, const char *buf, int len)
buf += add;
if (writer->buf_num + len <= writer->buf_cap)
{
memcpy(writer->buf, buf, len);
memcpy(writer->buf + writer->buf_num, buf, len);
writer->buf_num += len;
}
else if (writer->io(buf, len, writer->user_data) != len)