aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_operlog.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_operlog.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_operlog.cpp')
-rw-r--r--src/modules/m_operlog.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp
index cc533dbf5..d8006d9d5 100644
--- a/src/modules/m_operlog.cpp
+++ b/src/modules/m_operlog.cpp
@@ -54,7 +54,12 @@ class ModuleOperLog : public Module
{
Command* thiscommand = ServerInstance->Parser->GetHandler(command);
if ((thiscommand) && (thiscommand->flags_needed == 'o'))
- ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s %s",user->nick.c_str(), user->ident.c_str(), user->host.c_str(), command.c_str(), parameters.empty() ? "" : irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined().c_str());
+ {
+ std::string line;
+ if (!parameters.empty())
+ line = irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined();
+ ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s %s",user->nick.c_str(), user->ident.c_str(), user->host.c_str(), command.c_str(), line.c_str());
+ }
}
return MOD_RES_PASSTHRU;