about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-11-29 18:32:05 -0500
committerJune McEnroe <june@causal.agency>2020-11-29 18:32:05 -0500
commit3d749fe89f46d580f51f305345fde1aae42eecc5 (patch)
treef446ed21164a7f2bb6e9d6b2254d0bcdb7ebd243
parentFall back to multipart export for alternative without suitable inline (diff)
downloadbubger-3d749fe89f46d580f51f305345fde1aae42eecc5.tar.gz
bubger-3d749fe89f46d580f51f305345fde1aae42eecc5.zip
Fix bufferDest for when len requires more than cap * 2
-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");
 	}