Explorar el Código

UI: Allocate space for null terminator

Richard Stanway hace 7 años
padre
commit
69ffce3479
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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();
 		return std::string();
 
 
 	std::string str;
 	std::string str;
-	int size = (int)vsnprintf(nullptr, 0, format, args);
+	int size = (int)vsnprintf(nullptr, 0, format, args) + 1;
 	str.resize(size);
 	str.resize(size);
 	vsnprintf(&str[0], size, format, args);
 	vsnprintf(&str[0], size, format, args);
 	return str;
 	return str;