diff --git a/src/Components/Modules/GSC/IO.cpp b/src/Components/Modules/GSC/IO.cpp index 3709bfb7..5d67f4f7 100644 --- a/src/Components/Modules/GSC/IO.cpp +++ b/src/Components/Modules/GSC/IO.cpp @@ -15,6 +15,15 @@ namespace Components::GSC const auto* filepath = Game::Scr_GetString(0); const auto* mode = Game::Scr_GetString(1); + for (std::size_t i = 0; i < std::extent_v; ++i) + { + if (std::strstr(filepath, ForbiddenStrings[i]) != nullptr) + { + Logger::PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "OpenFile: directory traversal is not allowed!\n"); + return; + } + } + if (mode != "read"s) { Logger::PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "Valid openfile modes are 'read'\n");