From f7844096dcbe912557b46b0a52b35cf7cf6fc07e Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 20 Nov 2008 19:43:38 +0000 Subject: 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 --- src/modules/m_spanningtree/treesocket2.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) 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)) -- cgit v1.2.3