From cc1937a3af09508a5968d17ce4f7173829de12b3 Mon Sep 17 00:00:00 2001 From: Bernhard Schelling <14200249+schellingb@users.noreply.github.com> Date: Mon, 26 Oct 2020 10:44:04 +0900 Subject: [PATCH] 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 c20b01e9e1472625e338b1c3a7e657e6ff20213c. --- libretro-common/formats/json/rjson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretro-common/formats/json/rjson.c b/libretro-common/formats/json/rjson.c index 93695e6144..d972ceca00 100644 --- a/libretro-common/formats/json/rjson.c +++ b/libretro-common/formats/json/rjson.c @@ -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)