diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-07 22:05:15 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-07 22:05:15 +0000 |
commit | d46b8db930e1cd71751b76f9dd0451fddfda6c6d (patch) | |
tree | 10b7756a6374551b6b128b1af53df96dc9734ac4 /src/modules/m_sethost.cpp | |
parent | 4207f91ab44561f41eaadf75d528d669ea523eea (diff) |
Added a sanity check on the hostnames being set before actually setting them
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@433 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_sethost.cpp')
-rw-r--r-- | src/modules/m_sethost.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 774d5a00c..d1aabd004 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -21,6 +21,17 @@ Server *Srv; void handle_sethost(char **parameters, int pcnt, userrec *user) { + for (int x = 0; x < strlen(parameters[0]); x++) + { + if (((tolower(parameters[0][x]) < 'a') || (tolower(parameters[0][x]) > 'z')) && (parameters[0][x] != '.')) + { + if (((parameters[0][x] < '0') || (parameters[0][x]> '9')) && (parameters[0][x] != '-')) + { + Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname"); + return; + } + } + } strncpy(user->dhost,parameters[0],127); Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[1])); } |