summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-11-20 19:43:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-11-20 19:43:38 +0000
commitf7844096dcbe912557b46b0a52b35cf7cf6fc07e (patch)
treebd3e6531e629755721e2146325152ec10229cf4e /src/modules
parent125a7442f72800dc86b58bcd53e54eb73c3732af (diff)
Fix for potential crash with invalid prefixes (prefixes which are neither valid SID nor UID, but are a valid nickname, outdated protocol)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10810 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index b27661481..3ad9b3227 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -248,14 +248,25 @@ bool TreeSocket::ProcessLine(std::string &line)
* When would this be seen?
* Well, hopefully never. It could be caused by race conditions, bugs, or
* "miscreant" servers, though, so let's check anyway. -- w
+ *
+ * We also check here for totally invalid prefixes (prefixes that are neither
+ * a valid SID or a valid UUID, so that invalid UUID or SID never makes it
+ * to the higher level functions. -- B
*/
std::string direction = prefix;
User *t = this->ServerInstance->FindUUID(prefix);
if (t)
{
+ /* Find UID */
direction = t->server;
}
+ else if (!this->Utils->FindServer(direction))
+ {
+ /* Find SID */
+ ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Protocol violation: Invalid prefix '%s' from connection '%s'", direction.c_str(), this->GetName().c_str());
+ return true;
+ }
TreeServer* route_back_again = Utils->BestRouteTo(direction);
if ((!route_back_again) || (route_back_again->GetSocket() != this))