diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-11-24 08:29:05 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-11-24 08:29:05 +0000 |
commit | f5f20e377386228abc4ca176b25b244171f21f14 (patch) | |
tree | 5c2e5b4e569abe18a514843d1562627a5904b089 /src/modules/m_nickflood.cpp | |
parent | ad9cb625d950f8157c5ff4d6c89bfd9d672b2c05 (diff) |
Fix crashes in m_joinflood and m_nickflood, found by Schitz0, introduced by commit f123b4f0081360e96dad620e5a143f983c1f3a04 (time()) conversion - the settings classes had pointers that were *never* initialised...
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10819 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_nickflood.cpp')
-rw-r--r-- | src/modules/m_nickflood.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 4961e97a0..e281713c3 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -19,21 +19,19 @@ */ class nickfloodsettings : public classbase { + private: + InspIRCd* ServerInstance; public: - int secs; int nicks; time_t reset; time_t unlocktime; int counter; bool locked; - InspIRCd* ServerInstance; - - nickfloodsettings() : secs(0), nicks(0) {}; - nickfloodsettings(int b, int c) : secs(b), nicks(c) + nickfloodsettings(InspIRCd *Instance, int b, int c) : ServerInstance(Instance), secs(b), nicks(c) { - reset = ServerInstance->Time() + secs; + reset = Instance->Time() + secs; counter = 0; locked = false; }; @@ -144,7 +142,7 @@ class NickFlood : public ModeHandler if (!channel->GetExt("nickflood", dummy)) { parameter = ConvToStr(nnicks) + ":" +ConvToStr(nsecs); - nickfloodsettings *f = new nickfloodsettings(nsecs,nnicks); + nickfloodsettings *f = new nickfloodsettings(ServerInstance, nsecs, nnicks); channel->Extend("nickflood", f); channel->SetMode('F', true); channel->SetModeParam('F', parameter.c_str(), true); @@ -167,7 +165,7 @@ class NickFlood : public ModeHandler nickfloodsettings* f; channel->GetExt("nickflood", f); delete f; - f = new nickfloodsettings(nsecs, nnicks); + f = new nickfloodsettings(ServerInstance, nsecs, nnicks); channel->Shrink("nickflood"); channel->Extend("nickflood", f); channel->SetModeParam('F', cur_param.c_str(), false); |