From fde8acd97fc9179960b89e86c3850f7803a3d35c Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 20 Sep 2012 00:04:15 +0200 Subject: Fix possible crash in error() --- src/common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/common.c') diff --git a/src/common.c b/src/common.c index 0bd63be..f7ad7e6 100644 --- a/src/common.c +++ b/src/common.c @@ -51,13 +51,15 @@ void info(const char* format, ...) void error(const char* format, ...) { - va_list vargs; + va_list vargs, vargs2; va_start(vargs, format); + va_copy(vargs2, vargs); vsnprintf(idevicerestore_err_buff, idevicerestore_err_buff_size, format, vargs); + va_end(vargs); if (!error_disabled) { - vfprintf((error_stream) ? error_stream : stderr, format, vargs); + vfprintf((error_stream) ? error_stream : stderr, format, vargs2); } - va_end(vargs); + va_end(vargs2); } void debug(const char* format, ...) -- cgit v1.1-32-gdbae