From 02859be56d43bcece02aab350e02bc95ed1bf446 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 30 Sep 2012 01:10:57 +0200 Subject: Fix more undefined behavior caused by referencing the returned buffer by std::string::c_str() when the object is temporary See 83c7cc45daf6fb1f8c36f15297a4657e45a34e88 --- src/users.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index a4af8914b..29c670a66 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -789,7 +789,11 @@ void LocalUser::FullConnect() this->WriteNumeric(RPL_WELCOME, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick.c_str(), ServerInstance->Config->Network.c_str(), this->nick.c_str(), this->ident.c_str(), this->host.c_str()); this->WriteNumeric(RPL_YOURHOSTIS, "%s :Your host is %s, running version %s",this->nick.c_str(),ServerInstance->Config->ServerName.c_str(),BRANCH); this->WriteNumeric(RPL_SERVERCREATED, "%s :This server was created %s %s", this->nick.c_str(), __TIME__, __DATE__); - this->WriteNumeric(RPL_SERVERVERSION, "%s %s %s %s %s %s", this->nick.c_str(), ServerInstance->Config->ServerName.c_str(), BRANCH, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str()); + + std::string umlist = ServerInstance->Modes->UserModeList(); + std::string cmlist = ServerInstance->Modes->ChannelModeList(); + std::string pmlist = ServerInstance->Modes->ParaModeList(); + this->WriteNumeric(RPL_SERVERVERSION, "%s %s %s %s %s %s", this->nick.c_str(), ServerInstance->Config->ServerName.c_str(), BRANCH, umlist.c_str(), cmlist.c_str(), pmlist.c_str()); ServerInstance->Config->Send005(this); this->WriteNumeric(RPL_YOURUUID, "%s %s :your unique ID", this->nick.c_str(), this->uuid.c_str()); -- cgit v1.2.3