aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_censor.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2012-09-30 01:10:57 +0200
committerGravatar attilamolnar2012-09-30 03:04:07 +0200
commit02859be56d43bcece02aab350e02bc95ed1bf446 (patch)
treebbb68a91e26f4502c22047ad2b26ed8918c5fbb1 /src/modules/m_censor.cpp
parentFixed issue #303 - fixed Windows build (diff)
Fix more undefined behavior caused by referencing the returned buffer by std::string::c_str() when the object is temporary
See 83c7cc45daf6fb1f8c36f15297a4657e45a34e88
Diffstat (limited to 'src/modules/m_censor.cpp')
-rw-r--r--src/modules/m_censor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 5e832cc8b..bbf061f7e 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -128,9 +128,10 @@ class ModuleCensor : public Module
for (int index = 0; index < MyConf.Enumerate("badword"); index++)
{
- irc::string pattern = (MyConf.ReadValue("badword","text",index)).c_str();
- irc::string replace = (MyConf.ReadValue("badword","replace",index)).c_str();
- censors[pattern] = replace;
+ std::string str = MyConf.ReadValue("badword","text",index);
+ irc::string pattern(str.c_str());
+ str = MyConf.ReadValue("badword","replace",index);
+ censors[pattern] = irc::string(str.c_str());
}
}