From a5e2b50652d3f77886eca2489a1bfe6381155fde Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 7 Feb 2011 01:18:56 +0100 Subject: [PATCH] properly null-terminate formatted json strings --- blobmsg_json.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blobmsg_json.c b/blobmsg_json.c index 896a9c2..8195763 100644 --- a/blobmsg_json.c +++ b/blobmsg_json.c @@ -263,5 +263,7 @@ char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, blobmsg_jso return NULL; s.buf = realloc(s.buf, s.pos + 1); + s.buf[s.pos] = 0; + return s.buf; }