Explorar o código

UI: Fix non-Windows vstrprintf

vsnprintf is called twice; one call must use args, and one must use
args2 (which is how it was supposed to be from the beginning). Each call
"consumes" its va_list parameter, so they each need to use a separate
copy. Fixes potential corruption and/or crashing when calling vsnprintf.
Jim %!s(int64=3) %!d(string=hai) anos
pai
achega
646d47aacb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      UI/nix-update/nix-update-helpers.cpp

+ 1 - 1
UI/nix-update/nix-update-helpers.cpp

@@ -14,7 +14,7 @@ std::string vstrprintf(const char *format, va_list args)
 	std::string str;
 	int size = (int)vsnprintf(nullptr, 0, format, args2) + 1;
 	str.resize(size);
-	vsnprintf(&str[0], size, format, args2);
+	vsnprintf(&str[0], size, format, args);
 
 	va_end(args2);