diff --git a/Source/Core/DiscIO/NANDImporter.cpp b/Source/Core/DiscIO/NANDImporter.cpp index 94a15a84af..901f34fc37 100644 --- a/Source/Core/DiscIO/NANDImporter.cpp +++ b/Source/Core/DiscIO/NANDImporter.cpp @@ -122,10 +122,7 @@ void NANDImporter::FindSuperblock() std::string NANDImporter::GetPath(const NANDFSTEntry& entry, const std::string& parent_path) { - std::string name(reinterpret_cast(&entry.name), sizeof(NANDFSTEntry::name)); - // Get rid of any extra null characters - while (name.back() == '\0') - name.pop_back(); + std::string name(entry.name, strnlen(entry.name, sizeof(NANDFSTEntry::name))); if (name.front() == '/' || parent_path.back() == '/') return parent_path + name; diff --git a/Source/Core/DiscIO/NANDImporter.h b/Source/Core/DiscIO/NANDImporter.h index a6b55854b8..4cef7973c1 100644 --- a/Source/Core/DiscIO/NANDImporter.h +++ b/Source/Core/DiscIO/NANDImporter.h @@ -29,7 +29,7 @@ private: #pragma pack(push, 1) struct NANDFSTEntry { - u8 name[12]; + char name[12]; u8 mode; // 0x0C u8 attr; // 0x0D u16 sub; // 0x0E