diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-25 15:25:32 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-25 15:25:32 +0000 |
commit | 393c1afdd7bfede2b7f489d7ceb000c909c0fccf (patch) | |
tree | 5b8d58a9f51c3511d7d9ccc9da7674e8df69cd2d /src/userprocess.cpp | |
parent | 7b3105e5d4ea1877f8c30daaf069839ea890752d (diff) |
this should fix any of the crashes w00t outlined where User::MyClass == NULL.
The simplest fix seems to be that if the user has no class, skip all the code that uses the class values.
This makes sense because the only situation where User::MyClass == NULL is when they arent authorised to connect and are being quit so checking flood levels and max sendq etc are irrelevent.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8358 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/userprocess.cpp')
-rw-r--r-- | src/userprocess.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index a3c8bc305..eb5ea050c 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -101,21 +101,24 @@ void ProcessUserHandler::Call(User* cu) // AddBuffer returned false, theres too much data in the user's buffer and theyre up to no good. if (current->registered == REG_ALL) { - // Make sure they arn't flooding long lines. - if (Server->Time() > current->reset_due) + if (current->MyClass) { - current->reset_due = Server->Time() + current->MyClass->GetThreshold(); - current->lines_in = 0; - } - - current->lines_in++; - - if (current->MyClass->GetFlood() && current->lines_in > current->MyClass->GetFlood()) - Server->FloodQuitUser(current); - else - { - current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick, MAXBUF-2); - current->recvq.clear(); + // Make sure they arn't flooding long lines. + if (Server->Time() > current->reset_due) + { + current->reset_due = Server->Time() + current->MyClass->GetThreshold(); + current->lines_in = 0; + } + + current->lines_in++; + + if (current->MyClass->GetFlood() && current->lines_in > current->MyClass->GetFlood()) + Server->FloodQuitUser(current); + else + { + current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick, MAXBUF-2); + current->recvq.clear(); + } } } else |