Prechádzať zdrojové kódy

UI: Allocate space for null terminator

Richard Stanway 6 rokov pred
rodič
commit
69ffce3479
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  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;