mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-16 23:37:41 -05:00
Prevent path traversal in NANDImporter::ProcessEntry
Reported by MrSynAckster. A specifically crafted NAND dump could use path traversal to overwrite files on the host file system. This is also an accuracy fix for importing NAND dumps that contain file names that Dolphin is supposed to escape. Some games' save files are affected.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
|
||||
namespace DiscIO
|
||||
@@ -134,7 +135,7 @@ bool NANDImporter::ExtractFiles()
|
||||
std::string NANDImporter::GetPath(const NANDFSTEntry& entry, const std::string& parent_path)
|
||||
{
|
||||
std::string name(entry.name, strnlen(entry.name, sizeof(NANDFSTEntry::name)));
|
||||
return parent_path + '/' + name;
|
||||
return parent_path + '/' + Common::EscapeFileName(name);
|
||||
}
|
||||
|
||||
bool NANDImporter::ProcessEntry(u16 entry_number, const std::string& parent_path)
|
||||
|
||||
Reference in New Issue
Block a user