From fdcf7cc9afa99ba120298dafaa5b5907ee781fa4 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 18 Feb 2012 14:06:36 +0300 Subject: [PATCH] wpp: Properly use va_start/va_end around vsnprintf(). --- libs/wpp/ppl.l | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l index 98f3e1a3b2d..2718fd02ac7 100644 --- a/libs/wpp/ppl.l +++ b/libs/wpp/ppl.l @@ -329,6 +329,7 @@ void pp_writestring(const char *format, ...) va_start(valist, format); len = vsnprintf(buffer, buffercapacity, format, valist); + va_end(valist); /* If the string is longer than buffersize, vsnprintf returns * the string length with glibc >= 2.1, -1 with glibc < 2.1 */ while(len > buffercapacity || len < 0) @@ -345,10 +346,11 @@ void pp_writestring(const char *format, ...) return; } buffer = new_buffer; + va_start(valist, format); len = vsnprintf(buffer, buffercapacity, format, valist); + va_end(valist); } - va_end(valist); wpp_callbacks->write(buffer, len); } -- 2.11.4.GIT