diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-09-23 02:51:16 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-09-23 03:16:58 +0200 |
commit | 83c7cc45daf6fb1f8c36f15297a4657e45a34e88 (patch) | |
tree | c29ad7d8623eb7789c39c519de19ee414db2a95e /src/modules/m_spanningtree | |
parent | cff57f7ba780a5c4fc331ccbab489abdc572379c (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_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 75d4eaca3..11fdeb6cc 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -374,7 +374,8 @@ void SpanningTreeUtilities::ReadConfiguration() { ConfigTag* tag = i->second; reference<Link> L = new Link(tag); - L->Name = tag->getString("name").c_str(); + std::string linkname = tag->getString("name"); + L->Name = linkname.c_str(); L->AllowMask = tag->getString("allowmask"); L->IPAddr = tag->getString("ipaddr"); L->Port = tag->getInt("port"); |