summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-21 11:58:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-21 11:58:51 +0000
commitce6764c87f83c3a74aae0fcd75547a368601b14a (patch)
tree3101b494171b4d6f0e69f3b0583bc37c9ea8d8d6
parent82fdc01e33aa5e5bfb1315e811d9465f85241248 (diff)
Fix bug discovered by Ankit, m_rline loaded without regex provider causes segfault because of missing check for NULL when querying RegexProvider
interface git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10576 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_rline.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index e6340cc0f..7ea9d36b4 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -42,9 +42,12 @@ class CoreExport RLine : public XLine
throw ModuleException("Regex engine not set or loaded!");
}
- try {
+ try
+ {
regex = RegexFactoryRequest(mymodule, rxengine, regexs).Create();
- } catch (ModuleException& ex) {
+ }
+ catch (ModuleException& ex)
+ {
ServerInstance->SNO->WriteToSnoMask('x', "Bad regex: %s", ex.GetReason());
throw;
}
@@ -264,13 +267,16 @@ class ModuleRLine : public Module
rxengine = 0;
RegexEngine = newrxengine;
modulelist* ml = ServerInstance->Modules->FindInterface("RegularExpression");
- for (modulelist::iterator i = ml->begin(); i != ml->end(); ++i)
+ if (ml)
{
- std::string rxname = RegexNameRequest(this, *i).Send();
- if (rxname == newrxengine)
+ for (modulelist::iterator i = ml->begin(); i != ml->end(); ++i)
{
- ServerInstance->SNO->WriteToSnoMask('x', "R-Line now using engine '%s'", RegexEngine.c_str());
- rxengine = *i;
+ std::string rxname = RegexNameRequest(this, *i).Send();
+ if (rxname == newrxengine)
+ {
+ ServerInstance->SNO->WriteToSnoMask('x', "R-Line now using engine '%s'", RegexEngine.c_str());
+ rxengine = *i;
+ }
}
}
if (!rxengine)