summaryrefslogtreecommitdiff
path: root/src/modules/m_alias.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-09-23 02:51:16 +0200
committerattilamolnar <attilamolnar@hush.com>2012-09-23 03:16:58 +0200
commit83c7cc45daf6fb1f8c36f15297a4657e45a34e88 (patch)
treec29ad7d8623eb7789c39c519de19ee414db2a95e /src/modules/m_alias.cpp
parentcff57f7ba780a5c4fc331ccbab489abdc572379c (diff)
Fix undefined behavior caused by referencing the returned buffer by std::string::c_str() when the object is temporary
Thanks to @ChrisTX for pointing this out Fixes #257 reported by @helloall
Diffstat (limited to 'src/modules/m_alias.cpp')
-rw-r--r--src/modules/m_alias.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index ec426fe9b..6cb336c83 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -87,7 +87,8 @@ class ModuleAlias : public Module
{
ConfigTag* tag = i->second;
Alias a;
- a.AliasedCommand = tag->getString("text").c_str();
+ std::string aliastext = tag->getString("text");
+ a.AliasedCommand = aliastext.c_str();
tag->readString("replace", a.ReplaceFormat, true);
a.RequiredNick = tag->getString("requires");
a.ULineOnly = tag->getBool("uline");