diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 9a16522e1d..5ea5ad86ca 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -309,6 +309,10 @@ void MetaFileSystem::ThreadEnded(int threadID) int MetaFileSystem::ChDir(const std::string &dir) { + // Retain the old path and fail if the arg is 1023 bytes or longer. + if (dir.size() >= 1023) + return SCE_KERNEL_ERROR_NAMETOOLONG; + int curThread = __KernelGetCurThread(); std::string of;