summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-31 21:47:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-31 21:47:57 +0000
commit008850b6f3c5eff90d4e02805f15d28fd84d4e96 (patch)
tree006fc1551504270bed0fda8ee444f65c5aaba990 /src/modules/m_spanningtree.cpp
parent134e29c6b7a20c0501a53a9caf2f68e605e7d2b7 (diff)
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
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r--src/modules/m_spanningtree.cpp4
1 files changed, 3 insertions, 1 deletions
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());