]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dccallow.cpp
m_dccallow Validate tokens before use
[user/henk/code/inspircd.git] / src / modules / m_dccallow.cpp
index db0b54764919b4434e08b95b6fce5eedc73b8f81..829c1d3378ce91a3229f4de51ef15a6fc7a47611 100644 (file)
@@ -60,7 +60,7 @@ class CommandDccallow : public Command
  public:
        CommandDccallow(Module* parent) : Command(parent, "DCCALLOW", 0)
        {
-               syntax = "{[+|-]<nick> <time>|HELP|LIST}";
+               syntax = "[(+|-)<nick> [<time>]]|[LIST|HELP]";
                /* XXX we need to fix this so it can work with translation stuff (i.e. move +- into a seperate param */
        }
 
@@ -203,7 +203,7 @@ class CommandDccallow : public Command
 
        void DisplayHelp(User* user)
        {
-               user->WriteNumeric(998, "%s :DCCALLOW [<+|->nick [time]] [list] [help]", user->nick.c_str());
+               user->WriteNumeric(998, "%s :DCCALLOW [(+|-)<nick> [<time>]]|[LIST|HELP]", user->nick.c_str());
                user->WriteNumeric(998, "%s :You may allow DCCs from specific users by specifying a", user->nick.c_str());
                user->WriteNumeric(998, "%s :DCC allow for the user you want to receive DCCs from.", user->nick.c_str());
                user->WriteNumeric(998, "%s :For example, to allow the user Brain to send you inspircd.exe", user->nick.c_str());
@@ -339,6 +339,9 @@ class ModuleDCCAllow : public Module
                                        while (ss >> buf)
                                                tokens.push_back(buf);
 
+                                       if (tokens.size() < 2)
+                                               return MOD_RES_PASSTHRU;
+
                                        irc::string type = tokens[1].c_str();
 
                                        ConfigTag* conftag = ServerInstance->Config->ConfValue("dccallow");
@@ -346,6 +349,9 @@ class ModuleDCCAllow : public Module
 
                                        if (type == "SEND")
                                        {
+                                               if (tokens.size() < 3)
+                                                       return MOD_RES_PASSTHRU;
+
                                                std::string defaultaction = conftag->getString("action");
                                                std::string filename = tokens[2];