From f2b3b0bf660a8e3ce0584d92942edc00daef7b64 Mon Sep 17 00:00:00 2001 From: TheMatt2 Date: Mon, 3 Jan 2022 21:40:07 -0800 Subject: [PATCH] Check user input for the "/runmacro" command Presents users from specifying a file path, and looking up macros in the expected folder. --- dGame/dUtilities/SlashCommandHandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 47704d2b..5147cf16 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -611,6 +611,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit if (chatCommand == "runmacro" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) { if (args.size() != 1) return; + // Only process if input does not contain separator charaters + if (args[0].find("/") != std::string::npos) return; + if (args[0].find("\\") != std::string::npos) return; + std::ifstream infile("./res/macros/" + args[0] + ".scm"); if (infile.good()) {