Explorar o código

UI: Fix string conversion bug

Parameter two of os_wcs_to_utf8 is how many characters to convert, not
how big the buffer is.
jp9000 %!s(int64=11) %!d(string=hai) anos
pai
achega
6578e2952b
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      obs/platform-windows.cpp

+ 2 - 2
obs/platform-windows.cpp

@@ -73,11 +73,11 @@ bool InitApplicationBundle()
 string GetDefaultVideoSavePath()
 {
 	wchar_t path_utf16[MAX_PATH];
-	char    path_utf8[MAX_PATH];
+	char    path_utf8[MAX_PATH]  = {};
 
 	SHGetFolderPathW(NULL, CSIDL_MYVIDEO, NULL, SHGFP_TYPE_CURRENT,
 			path_utf16);
 
-	os_wcs_to_utf8(path_utf16, MAX_PATH, path_utf8);
+	os_wcs_to_utf8(path_utf16, wcslen(path_utf16), path_utf8);
 	return string(path_utf8);
 }