diff --git a/utils/path_util.cpp b/utils/path_util.cpp index b00ab1a66..cde142d2b 100644 --- a/utils/path_util.cpp +++ b/utils/path_util.cpp @@ -45,8 +45,10 @@ std::string pesieve::util::escape_path_separators(std::string path) std::string pesieve::util::get_system_drive() { - char buf[MAX_PATH]; - GetWindowsDirectory(buf, MAX_PATH); + char buf[MAX_PATH] = { 0 }; + if (!GetWindowsDirectoryA(buf, MAX_PATH)) { + return ""; + } buf[2] = '\0'; // cut after the drive letter return std::string(buf); }