From bec913b40cf9153fd6a021b33cecda97ff76be47 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 23 Nov 2015 09:56:51 +0100 Subject: [PATCH] json: fix malformed output Even though the json output callback is called with a null terminated string, it's not useable directly. The size parameter to the callback might be a lot smaller than the string size. Libjansson gives the size up to the first point that needs escaping. --- src/output-json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output-json.c b/src/output-json.c index 9cc9bd94b4..fcc3a9559e 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -345,7 +345,7 @@ static int MemBufferCallback(const char *str, size_t size, void *data) MemBufferExpand(&memb, OUTPUT_BUFFER_SIZE); } #endif - MemBufferWriteString(memb, "%s", str); + MemBufferWriteRaw(memb, str, size); return 0; } -- 2.47.2