From b1725dfb33f057784e673796d4f7063e2718b167 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Sun, 16 Oct 2022 17:12:04 +0200 Subject: [PATCH] Zero-initialize structures passed to FatFs functions. --- Source/Core/Common/FatFsUtil.cpp | 12 ++++++------ Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index 37fbae4b91..b003e48f5b 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -360,7 +360,7 @@ static bool Pack(const File::FSTEntry& entry, bool is_root, std::vector& tmp return false; } - FIL dst; + FIL dst{}; const auto open_error_code = f_open(&dst, entry.virtualName.c_str(), FA_CREATE_ALWAYS | FA_WRITE); if (open_error_code != FR_OK) @@ -549,7 +549,7 @@ bool SyncSDFolderToSDImage(bool deterministic) return false; } - FATFS fs; + FATFS fs{}; const auto mount_error_code = f_mount(&fs, "", 0); if (mount_error_code != FR_OK) { @@ -591,7 +591,7 @@ static bool Unpack(const std::string path, bool is_directory, const char* name, { if (!is_directory) { - FIL src; + FIL src{}; const auto open_error_code = f_open(&src, name, FA_READ); if (open_error_code != FR_OK) { @@ -667,7 +667,7 @@ static bool Unpack(const std::string path, bool is_directory, const char* name, return false; } - DIR directory; + DIR directory{}; const auto opendir_error_code = f_opendir(&directory, "."); if (opendir_error_code != FR_OK) { @@ -676,7 +676,7 @@ static bool Unpack(const std::string path, bool is_directory, const char* name, return false; } - FILINFO entry; + FILINFO entry{}; while (true) { const auto readdir_error_code = f_readdir(&directory, &entry); @@ -767,7 +767,7 @@ bool SyncSDImageToSDFolder() return false; } - FATFS fs; + FATFS fs{}; const auto mount_error_code = f_mount(&fs, "", 0); if (mount_error_code != FR_OK) { diff --git a/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp b/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp index ea0e828d29..a2805000ff 100644 --- a/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp +++ b/Source/Core/Core/IOS/Network/KD/VFF/VFFUtil.cpp @@ -185,7 +185,7 @@ namespace IOS::HLE::NWC24 { static ErrorCode WriteFile(const std::string& filename, const std::vector& tmp_buffer) { - FIL dst; + FIL dst{}; const auto open_error_code = f_open(&dst, filename.c_str(), FA_CREATE_ALWAYS | FA_WRITE); if (open_error_code != FR_OK) { @@ -269,7 +269,7 @@ ErrorCode OpenVFF(const std::string& path, const std::string& filename, Common::ScopeGuard vff_delete_guard{[&] { fs->Delete(PID_KD, PID_KD, path); }}; - FATFS fatfs; + FATFS fatfs{}; const FRESULT fatfs_mount_error_code = f_mount(&fatfs, "", 0); if (fatfs_mount_error_code != FR_OK) {