浏览代码

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 3 年之前
父节点
当前提交
646d47aacb
共有 1 个文件被更改,包括 1 次插入1 次删除
  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);