aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index f273f45..b508310 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -166,10 +166,13 @@ int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap)
ENSURE_SIZE(buf, expected_size);
while (1) {
+ va_list args;
+ va_copy(args, ap);
+
len = vsnprintf(
(char *)buf->ptr + buf->size,
buf->asize - buf->size,
- format, ap
+ format, args
);
if (len < 0) {