summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-09-30 01:10:57 +0200
committerattilamolnar <attilamolnar@hush.com>2012-09-30 03:04:07 +0200
commit02859be56d43bcece02aab350e02bc95ed1bf446 (patch)
treebbb68a91e26f4502c22047ad2b26ed8918c5fbb1 /src/server.cpp
parent83e90c4baa1215caf05295aec86a0a4d7bfff3f9 (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/server.cpp')
-rw-r--r--src/server.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index b7e58c56b..30d204aa4 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -70,7 +70,10 @@ std::string InspIRCd::GetVersionString(bool operstring)
{
char versiondata[MAXBUF];
if (operstring)
- snprintf(versiondata,MAXBUF,"%s %s :%s [%s,%s,%s]",VERSION,Config->ServerName.c_str(),SYSTEM,REVISION,SE->GetName().c_str(),Config->sid.c_str());
+ {
+ std::string sename = SE->GetName();
+ snprintf(versiondata,MAXBUF,"%s %s :%s [%s,%s,%s]",VERSION, Config->ServerName.c_str(), SYSTEM,REVISION, sename.c_str(), Config->sid.c_str());
+ }
else
snprintf(versiondata,MAXBUF,"%s %s :%s",BRANCH,Config->ServerName.c_str(),Config->CustomVersion.c_str());
return versiondata;