浏览代码

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