From 0b3f568a7506fb7ddc9a24d6ab12a969befb923d Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 26 May 2014 12:07:22 +0200 Subject: Switch to std::string::compare() from substr() in a couple of places --- src/modules/m_spanningtree/compat.cpp | 2 +- src/modules/m_spanningtree/uid.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 1d573b8b4..857e95da9 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -114,7 +114,7 @@ void TreeSocket::WriteLine(const std::string& original_line) // We're sending channel metadata line.erase(c, d-c); } - else if (line.substr(c, d-c) == " operquit") + else if (!line.compare(c, d-c, " operquit", 9)) { // ":22D METADATA 22DAAAAAX operquit :message" -> ":22DAAAAAX OPERQUIT :message" line = ":" + line.substr(b+1, c-b) + "OPERQUIT" + line.substr(d); diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 51f7026dd..e9e3e217d 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -37,7 +37,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vectorGetID()) + if (params[0].length() != UIDGenerator::UUID_LENGTH || params[0].compare(0, 3, remoteserver->GetID())) throw ProtocolException("Bogus UUID"); /* Check parameters for validity before introducing the client, discovered by dmb */ if (modestr[0] != '+') -- cgit v1.2.3