diff --git a/via/via_system_windows.cpp b/via/via_system_windows.cpp index 4234efddb8..a0fc19a690 100644 --- a/via/via_system_windows.cpp +++ b/via/via_system_windows.cpp @@ -34,7 +34,7 @@ ViaSystemWindows::ViaSystemWindows() : ViaSystem() { // Determine the user's home directory char home_drive[32]; - char generic_string[1024]; + char generic_string[1024] = {}; if (0 == GetEnvironmentVariableA("HOMEDRIVE", home_drive, 31) || 0 == GetEnvironmentVariableA("HOMEPATH", generic_string, 1023)) { LogError("Failed to retrieve either HOMEDRIVE or HOMEPATH environment settings!"); @@ -60,7 +60,7 @@ ViaSystemWindows::ViaSystemWindows() : ViaSystem() { } // Get the path to the current EXE - char temp_c_string[1024]; + char temp_c_string[1024] = {}; int bytes = GetModuleFileName(NULL, temp_c_string, 1023); if (0 < bytes) { // Replace all Windows directory symbols with Linux versions for C++ calls @@ -199,7 +199,7 @@ static bool FindNextRegKey(HKEY regFolder, const char *keyPath, const char *keyS lret = RegOpenKeyExA(regFolder, keyPath, 0, keyFlags, &hKey); if (lret == ERROR_SUCCESS) { DWORD index = 0; - char keyName[1024]; + char keyName[1024] = {}; do { lret = RegEnumKeyExA(hKey, index, keyName, &bufLen, NULL, NULL, NULL, NULL); @@ -240,7 +240,7 @@ static bool FindNextRegValue(HKEY regFolder, const char *keyPath, const char *va lret = RegOpenKeyExA(regFolder, keyPath, 0, keyFlags, &hKey); if (lret == ERROR_SUCCESS) { DWORD index = startIndex; - char valueName[1024]; + char valueName[1024] = {}; do { DWORD type = REG_DWORD; @@ -368,7 +368,7 @@ void FindRegistryJsons(std::vector ®istry_top_hkey, std::vector &override_paths, ViaSystem::ViaResults &res) { bool found = false; std::string cur_registry_loc; - char temp_string[1024]; + char temp_string[1024] = {}; for (uint32_t layer = 0; layer < static_cast(cur_layer_json.size()); layer++) { std::string cur_layer_json_path = std::get<2>(cur_layer_json[layer]); @@ -1633,10 +1633,10 @@ bool ViaSystemWindows::PrintImplicitLayersRegInfo(std::vector registry_locations; std::vector> layer_jsons; std::string system_path; - char generic_string[1024]; + char generic_string[1024] = {}; const char vulkan_public_reg_base[] = "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers"; const char vulkan_implicit_reg_key[] = "VulkanImplicitLayerPaths"; const char vulkan_driver_reg_key[] = "VulkanImplicitLayers"; @@ -1798,7 +1798,7 @@ ViaSystem::ViaResults ViaSystemWindows::FindAndPrintAllExplicitLayersInPath(cons HANDLE hFind; uint32_t i = 0; ViaResults res = VIA_SUCCESSFUL; - char full_layer_path[1024]; + char full_layer_path[1024] = {}; // Look for any JSON files in that folder. snprintf(full_layer_path, 1023, "%s\\*.json", layer_path.c_str()); @@ -1860,7 +1860,7 @@ ViaSystem::ViaResults ViaSystemWindows::FindAndPrintAllExplicitLayersInPath(cons ViaSystem::ViaResults ViaSystemWindows::PrintLayerEnvVar(const char* var, bool& printed_more_layers) { ViaResults result = VIA_SUCCESSFUL; - char generic_string[1024]; + char generic_string[1024] = {}; // If the user's system has the provied environment variable set, dump out the layer // information found in that folder. This is important because if @@ -2001,7 +2001,7 @@ ViaSystem::ViaResults ViaSystemWindows::PrintSystemSettingsFileInfo() { PrintBeginTable("Vulkan Layer Settings File", 4); // If the settings path environment variable is set, use that. - char generic_string[1024]; + char generic_string[1024] = {}; if (0 != GetEnvironmentVariableA("VK_LAYER_SETTINGS_PATH", generic_string, 1023)) { std::string full_file = generic_string; full_file += '\\'; @@ -2071,7 +2071,7 @@ ViaSystem::ViaResults ViaSystemWindows::PrintSystemSettingsFileInfo() { uint32_t i = 0; uint32_t returned_value = 0; bool printed = false; - char cur_vulkan_driver_json[1024]; + char cur_vulkan_driver_json[1024] = {}; while (FindNextRegValue(registry_top_hkey[iter], registry_locations[iter].c_str(), "", i, 1023, cur_vulkan_driver_json, &returned_value)) { GenerateSettingsFileJsonInfo(cur_vulkan_driver_json); @@ -2096,7 +2096,7 @@ ViaSystem::ViaResults ViaSystemWindows::PrintSystemSettingsFileInfo() { std::string ViaSystemWindows::GetEnvironmentalVariableValue(const std::string &env_var) { std::string return_value; - char temp_buffer[1024]; + char temp_buffer[1024] = {}; if (0 != GetEnvironmentVariableA(env_var.c_str(), temp_buffer, 1023)) { return_value = temp_buffer; }