about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--decode.c2
1 files changed, 1 insertions, 1 deletions
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");
 	}