浏览代码

UI: Allocate space for null terminator

Richard Stanway 6 年之前
父节点
当前提交
69ffce3479
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      UI/win-update/win-update-helpers.cpp

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

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