From c3d36940c755ddb43d8e6d7cc8f34c054e89d620 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 14 Mar 2020 11:00:01 +0200 Subject: [PATCH] cellSaveData: do not allow to read/write/delete system files in funcFile Return param error 70 as realhw in this case. --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 35accbf2ab..ac13e73e87 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1573,6 +1573,17 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v name[0] = '-'; } + if ((dotpos >= 5u && std::memcmp(name, "PARAM", 5) == 0) || + (dotpos >= 4u && std::memcmp(name, "ICON", 4) == 0) || + (dotpos >= 3u && std::memcmp(name, "PIC", 3) == 0) || + (dotpos >= 3u && std::memcmp(name, "SND", 3) == 0)) + { + // ****** sysutil savedata parameter error : 70 ****** + cellSaveData.error("savedata_op(): fileSet->fileName is set to a system file name (%s)", file_path); + savedata_result = {CELL_SAVEDATA_ERROR_PARAM, "70"}; + break; + } + // Check filename if (sysutil_check_name_string(name, 1, 9) == -1) {