diff --git a/libevent/buffer.c b/libevent/buffer.c index e09cc3d..1585389 100644 --- a/libevent/buffer.c +++ b/libevent/buffer.c @@ -132,17 +132,20 @@ evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap) size_t space; size_t oldoff = buf->off; int sz; + va_list aq; for (;;) { buffer = buf->buffer + buf->off; space = buf->totallen - buf->misalign - buf->off; + va_copy(aq, ap); #ifdef WIN32 - sz = vsnprintf(buffer, space - 1, fmt, ap); + sz = vsnprintf(buffer, space - 1, fmt, aq); buffer[space - 1] = '\0'; #else - sz = vsnprintf(buffer, space, fmt, ap); + sz = vsnprintf(buffer, space, fmt, aq); #endif + va_end(aq); if (sz == -1) return (-1); if (sz < space) {