diff options
Diffstat (limited to 'src/common/strlib.c')
-rw-r--r-- | src/common/strlib.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/strlib.c b/src/common/strlib.c index 93b69ab54..5580124e1 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -964,9 +964,12 @@ int StringBuf_Vprintf(StringBuf* self, const char* fmt, va_list ap) for(;;) { + va_list apcopy; /* Try to print in the allocated space. */ size = self->max_ - (self->ptr_ - self->buf_); + va_copy(apcopy, ap); n = vsnprintf(self->ptr_, size, fmt, ap); + va_end(ap); /* If that worked, return the length. */ if( n > -1 && n < size ) { |