properly null-terminate formatted json strings
authorFelix Fietkau <nbd@openwrt.org>
Mon, 7 Feb 2011 00:18:56 +0000 (01:18 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 7 Feb 2011 00:18:56 +0000 (01:18 +0100)
blobmsg_json.c

index 896a9c2..8195763 100644 (file)
@@ -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);
                return NULL;
 
        s.buf = realloc(s.buf, s.pos + 1);
+       s.buf[s.pos] = 0;
+
        return s.buf;
 }
        return s.buf;
 }