From 1450bfb846c6c19d520f5e253ace56b7d8fa4c60 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 18 Oct 2009 19:33:41 +0000 Subject: 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 --- src/modules/m_alias.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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()); } } -- cgit v1.2.3