From e4907b2ac7c9c17868128a868a033efbbc0625ea Mon Sep 17 00:00:00 2001 From: w00t Date: Thu, 31 Dec 2009 20:49:35 +0000 Subject: Check channel name in SVSJOIN to avoid propegating an invalid channel, fixes bug #928. This will result in a mild desync if someone has (ab)used SVSJOIN when linking a server running this to their network, but since those channels are screwed anyway.. Conflicts: src/modules/m_spanningtree/svsjoin.cpp git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12235 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/svsjoin.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index 4fdc05dea..d8df6fb95 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -25,18 +25,23 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, parameterlist ¶ms) { + // Check params if (params.size() < 2) return true; + // Check for valid channel name + if (!ServerInstance->IsChannel(params[1].c_str(), ServerInstance->Config->Limits.ChanMax)) + return true; + + // Check target exists User* u = ServerInstance->FindNick(params[0]); + if (!u) + return true; - if (u) - { - /* only join if it's local, otherwise just pass it on! */ - if (IS_LOCAL(u)) - Channel::JoinUser(u, params[1].c_str(), false, "", false, ServerInstance->Time()); - Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix); - } + /* only join if it's local, otherwise just pass it on! */ + if (IS_LOCAL(u)) + Channel::JoinUser(u, params[1].c_str(), false, "", false, ServerInstance->Time()); + Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix); return true; } -- cgit v1.2.3