blobmsg_json: fix buffer growing on blobmsg json formatting
authorFelix Fietkau <nbd@openwrt.org>
Tue, 29 Jan 2013 22:06:55 +0000 (23:06 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 29 Jan 2013 22:07:10 +0000 (23:07 +0100)
blobmsg_json.c

index d4f68465512b2fccc92c0c415049b4458ed947ee..f16635834fb9ccc53ba76515dd08e4f04ab4e2f2 100644 (file)
@@ -108,7 +108,7 @@ static bool blobmsg_puts(struct strbuf *s, const char *c, int len)
                return true;
 
        if (s->pos + len >= s->len) {
-               s->len += 16;
+               s->len += 16 + len;
                s->buf = realloc(s->buf, s->len);
                if (!s->buf)
                        return false;