Commit fdcf7cc9 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wpp: Properly use va_start/va_end around vsnprintf().

parent 945e16c2
...@@ -329,6 +329,7 @@ void pp_writestring(const char *format, ...) ...@@ -329,6 +329,7 @@ void pp_writestring(const char *format, ...)
va_start(valist, format); va_start(valist, format);
len = vsnprintf(buffer, buffercapacity, len = vsnprintf(buffer, buffercapacity,
format, valist); format, valist);
va_end(valist);
/* If the string is longer than buffersize, vsnprintf returns /* If the string is longer than buffersize, vsnprintf returns
* the string length with glibc >= 2.1, -1 with glibc < 2.1 */ * the string length with glibc >= 2.1, -1 with glibc < 2.1 */
while(len > buffercapacity || len < 0) while(len > buffercapacity || len < 0)
...@@ -345,10 +346,11 @@ void pp_writestring(const char *format, ...) ...@@ -345,10 +346,11 @@ void pp_writestring(const char *format, ...)
return; return;
} }
buffer = new_buffer; buffer = new_buffer;
va_start(valist, format);
len = vsnprintf(buffer, buffercapacity, len = vsnprintf(buffer, buffercapacity,
format, valist); format, valist);
va_end(valist);
} }
va_end(valist);
wpp_callbacks->write(buffer, len); wpp_callbacks->write(buffer, len);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment