From 3d749fe89f46d580f51f305345fde1aae42eecc5 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 29 Nov 2020 18:32:05 -0500 Subject: Fix bufferDest for when len requires more than cap * 2 --- decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decode.c b/decode.c index 684b5d2..5d875ca 100644 --- a/decode.c +++ b/decode.c @@ -55,7 +55,7 @@ static struct Buffer bufferAlloc(size_t cap) { static char *bufferDest(struct Buffer *buf, size_t len) { if (buf->len + len > buf->cap) { - buf->cap *= 2; + while (buf->len + len > buf->cap) buf->cap *= 2; buf->ptr = realloc(buf->ptr, buf->cap); if (!buf->ptr) err(EX_OSERR, "realloc"); } -- cgit 1.4.1