aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys/patch_manager.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-11 10:08:10 -0500
committerLioncash <mathew1800@gmail.com>2018-12-11 10:08:13 -0500
commit9cb11d1ae421c3eaf9ca2325c25c7ae32c8a7349 (patch)
treeb2e397a03cf3f604cba8b054beb294d913a2ad0f /src/core/file_sys/patch_manager.cpp
parentd2177aa20d3663ff2e69e06eabee790a7899c087 (diff)
patch_manager: Prevent use of a dangling pointer within PatchRomFS
fmt::format() returns a std::string instance by value, so calling .c_str() on it here is equivalent to doing: auto* ptr = std::string{}.c_str(); The data being pointed to isn't guaranteed to actually be valid anymore after that expression ends. Instead, we can just take the string as is, and provide the necessary formatting parameters.
Diffstat (limited to 'src/core/file_sys/patch_manager.cpp')
-rw-r--r--src/core/file_sys/patch_manager.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index ecdc21c87b..61706966e0 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -286,13 +286,12 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t
VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type,
VirtualFile update_raw) const {
const auto log_string = fmt::format("Patching RomFS for title_id={:016X}, type={:02X}",
- title_id, static_cast<u8>(type))
- .c_str();
+ title_id, static_cast<u8>(type));
if (type == ContentRecordType::Program || type == ContentRecordType::Data)
- LOG_INFO(Loader, log_string);
+ LOG_INFO(Loader, "{}", log_string);
else
- LOG_DEBUG(Loader, log_string);
+ LOG_DEBUG(Loader, "{}", log_string);
if (romfs == nullptr)
return romfs;