summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-28 22:18:49 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-12-28 22:18:49 +0000
commitb0546ed55e040330dd28a856d6fab2e55863dd1f (patch)
tree2d5f5da2e0540e8437bf5d7aa34b1ed776c62245 /src/commands
parent376a2833d9274a83e3571da1b69ce2768a7c8bac (diff)
Fix bug spotted by KingTarquin, if an empty string is given to /stats with "STATS :", then a byte of undefined memory in a std::string object is read as the stats char. Probably unsafe.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10927 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cmd_stats.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index d362d4614..05c4ae0d2 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -39,7 +39,8 @@ CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User
if (IS_LOCAL(user))
{
string_list values;
- DoStats(this->ServerInstance, parameters[0][0], user, values);
+ char search = parameters[0].length() ? parameters[0][0] : 0;
+ DoStats(this->ServerInstance, search, user, values);
for (size_t i = 0; i < values.size(); i++)
user->Write(":%s", values[i].c_str());
}