summaryrefslogtreecommitdiff
path: root/modules/m_xmlrpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/m_xmlrpc.cpp')
-rw-r--r--modules/m_xmlrpc.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/modules/m_xmlrpc.cpp b/modules/m_xmlrpc.cpp
index 66b280a38..d3ab128aa 100644
--- a/modules/m_xmlrpc.cpp
+++ b/modules/m_xmlrpc.cpp
@@ -107,7 +107,7 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage
prev = cur;
cur.clear();
- int len = 0;
+ size_t len = 0;
istag = false;
if (content[0] == '<')
@@ -120,20 +120,21 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage
len = content.find_first_of('<');
}
- if (len)
+ // len must advance
+ if (len == Anope::string::npos || len == 0)
+ break;
+
+ if (istag)
+ {
+ cur = content.substr(1, len - 1);
+ content.erase(0, len + 1);
+ while (!content.empty() && content[0] == ' ')
+ content.erase(content.begin());
+ }
+ else
{
- if (istag)
- {
- cur = content.substr(1, len - 1);
- content.erase(0, len + 1);
- while (!content.empty() && content[0] == ' ')
- content.erase(content.begin());
- }
- else
- {
- cur = content.substr(0,len);
- content.erase(0, len);
- }
+ cur = content.substr(0, len);
+ content.erase(0, len);
}
}
while (istag && !content.empty());