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
This commit is contained in:
brain 2008-12-28 22:18:49 +00:00
parent 376a2833d9
commit b0546ed55e

View File

@ -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());
}