From 008850b6f3c5eff90d4e02805f15d28fd84d4e96 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 31 Aug 2006 21:47:57 +0000 Subject: Fix for bug #134 reported by mixx941: When user connects to ircd with no usermodes set on themselves, an m_spanningtree std::string throws a range exception because we try and substr npos. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5091 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 9610aa07e..335624ec5 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1694,7 +1694,9 @@ class TreeSocket : public InspSocket /* This used to have a pretty craq'y loop doing the same thing, * now we just let the STL do the hard work (more efficiently) */ - params[5] = params[5].substr(params[5].find_first_not_of('+')); + std::string::size_type pos_after_plus = params[5].find_first_not_of('+'); + if (pos_after_plus != std::string::npos) + params[5] = params[5].substr(pos_after_plus); const char* tempnick = params[1].c_str(); ServerInstance->Log(DEBUG,"Introduce client %s!%s@%s",tempnick,params[4].c_str(),params[2].c_str()); -- cgit v1.2.3