From 4cbb91509431fa68069c8f76202b85290f9f3b87 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 8 Apr 2004 00:56:51 +0000 Subject: Sanity checks in SAJOIN and SAPART git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@441 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_filter.cpp | 2 +- src/modules/m_sajoin.cpp | 10 ++++++++++ src/modules/m_sapart.cpp | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 9459d309f..b16039abd 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -152,7 +152,7 @@ class ModuleFilter : public Module std::string filterfile = Conf->ReadValue("filter","file",0); // this automatically re-reads the configuration file into the class MyConf = new ConfigReader(filterfile); - if ((filterfile == "")|| (!MyConf->Verify())) + if ((filterfile == "") || (!MyConf->Verify())) { // bail if the user forgot to create a config file printf("Error, could not find definition in your config file!"); diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 94175a523..e687e474d 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -15,6 +15,16 @@ void handle_sajoin(char **parameters, int pcnt, userrec *user) userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) { + + for (int x = 0; x < strlen(parameters[0]); x++) + { + if ((parameters[0][0] != '#') || (parameters[0][x] == ' ') || (parameters[0][x]> ',')) + { + Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name"); + return; + } + } + Srv->SendOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]); Srv->JoinUserToChannel(dest,std::string(parameters[1]),std::string(dest->nick)); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 266ed5a04..fdbbcc102 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -15,6 +15,15 @@ void handle_sapart(char **parameters, int pcnt, userrec *user) userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) { + for (int x = 0; x < strlen(parameters[0]); x++) + { + if ((parameters[0][0] != '#') || (parameters[0][x] == ' ') || (parameters[0][x]> ',')) + { + Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name"); + return; + } + } + Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]); Srv->PartUserFromChannel(dest,std::string(parameters[1]),std::string(dest->nick)); } -- cgit v1.2.3