From 0c09feae5bb8f1ce0bf07d412bebc86a8087ef04 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 27 Feb 2015 18:46:29 -0500 Subject: [PATCH] Prevent backslashes from being used in command names --- library/Core.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/Core.cpp b/library/Core.cpp index dac776506..d206a7c62 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -460,6 +460,18 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve { if (!first.empty()) { + // Disallow backslashes in commands (e.g. script names), for consistency + if(first.find('\\') != std::string::npos) + { + std::string suggestion = first; + for (size_t i = 0; i < suggestion.size(); i++) + { + if (suggestion[i] == '\\') + suggestion[i] = '/'; + } + con.printerr("Backslashes in command names are not valid. Use %s instead.\n", suggestion.c_str()); + return CR_NOT_IMPLEMENTED; + } // let's see what we actually got if(first=="help" || first == "?" || first == "man") {