summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-18 19:33:41 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-18 19:33:41 +0000
commit1450bfb846c6c19d520f5e253ace56b7d8fa4c60 (patch)
tree0eff5fd450fd4b25e18a53713b392c7ab2203820
parent1db755d190e2a6f099905d1ba11ca01c6b273dc9 (diff)
Fix infinite loop on alias expansion, found by Adam
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11908 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_alias.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 522259ebd..747a3ee93 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -316,13 +316,14 @@ class ModuleAlias : public Module
std::string var = "$";
var.append(ConvToStr(v));
var.append("-");
+ std::string repl = GetVar(var, original_line);
std::string::size_type x = newline.find(var);
while (x != std::string::npos)
{
newline.erase(x, var.length());
- newline.insert(x, GetVar(var, original_line));
- x = newline.find(var);
+ newline.insert(x, repl);
+ x = newline.find(var, x + repl.length());
}
var = "$";
@@ -332,8 +333,8 @@ class ModuleAlias : public Module
while (x != std::string::npos)
{
newline.erase(x, var.length());
- newline.insert(x, GetVar(var, original_line));
- x = newline.find(var);
+ newline.insert(x, repl);
+ x = newline.find(var, x + repl.length());
}
}