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

Alexandre Julliard julliard at winehq.org
Mon Feb 20 11:17:32 CST 2012


Module: wine
Branch: master
Commit: fdcf7cc9afa99ba120298dafaa5b5907ee781fa4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fdcf7cc9afa99ba120298dafaa5b5907ee781fa4

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Feb 18 14:06:36 2012 +0300

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

---

 libs/wpp/ppl.l |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index 98f3e1a..2718fd0 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);
 }




More information about the wine-cvs mailing list