From 6578e2952bf9451348fc4c203693f239190708c6 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 22 May 2014 03:00:16 -0700 Subject: [PATCH] UI: Fix string conversion bug Parameter two of os_wcs_to_utf8 is how many characters to convert, not how big the buffer is. --- obs/platform-windows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/platform-windows.cpp b/obs/platform-windows.cpp index e34f3e526..55a76e042 100644 --- a/obs/platform-windows.cpp +++ b/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); }