From adeb4fe02f92637395c4b1742f2d60405105c75c Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Sun, 13 Dec 2020 14:10:44 +0100 Subject: [PATCH] Handle case where the log path has more that MAX_PATH characters --- components/crashcatcher/windows_crashmonitor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/crashcatcher/windows_crashmonitor.cpp b/components/crashcatcher/windows_crashmonitor.cpp index 56f8bbdd4c..8976deb2ea 100644 --- a/components/crashcatcher/windows_crashmonitor.cpp +++ b/components/crashcatcher/windows_crashmonitor.cpp @@ -152,10 +152,13 @@ namespace Crash if (miniDumpWriteDump == NULL) return; - const std::wstring utf16Path = utf8ToUtf16(mShm->mStartup.mLogFilePath); + std::wstring utf16Path = utf8ToUtf16(mShm->mStartup.mLogFilePath); if (utf16Path.empty()) return; + if (utf16Path.length() > MAX_PATH) + utf16Path = LR"(\\?\)" + utf16Path; + HANDLE hCrashLog = CreateFileW(utf16Path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hCrashLog == NULL || hCrashLog == INVALID_HANDLE_VALUE) return;