From ba7ad73e928de9972398def61c5758c42b23aec2 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 7 May 2021 18:19:42 +0200 Subject: [PATCH] NetPlay: Check that memory card region is valid --- Source/Core/Core/NetPlayClient.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index c82cb891d8..f073e70f17 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -859,6 +859,13 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet) bool mc251; packet >> is_slot_a >> region >> mc251; + // This check is mainly intended to filter out characters which have special meanings in paths + if (region != JAP_DIR && region != USA_DIR && region != EUR_DIR) + { + SyncSaveDataResponse(false); + return 0; + } + const std::string path = File::GetUserPath(D_GCUSER_IDX) + GC_MEMCARD_NETPLAY + (is_slot_a ? "A." : "B.") + region + (mc251 ? ".251" : "") + ".raw"; if (File::Exists(path) && !File::Delete(path))