1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-03-22 13:19:40 +01:00

CSmmAPI::CacheUserMessages now checks to ensure that the number of messages falls within the bounds of an unsigned byte

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40339
This commit is contained in:
Scott Ehlert 2007-02-21 05:26:38 +00:00
parent bf3d98f77c
commit b663f41ee0

View File

@ -551,9 +551,16 @@ bool CSmmAPI::CacheUserMessages()
m_MsgCount = dict->Count();
// Cache messages in our CUtlDict
UserMessage *msg;
// Make sure count falls within bounds of an unsigned byte (engine sends message types as such)
if (m_MsgCount < 0 || m_MsgCount > 255)
{
m_MsgCount = -1;
return false;
}
UserMessage *msg;
// Cache messages in our CUtlDict
for (int i = 0; i < m_MsgCount; i++)
{
msg = dict->Element(i);