From 3a1e08abd45062759a9b4e7e080198608031b44c Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 4 May 2017 17:49:28 +0300 Subject: [PATCH] Fix memory corruption bugs due the array index out of bounds. (#147) --- regamedll/dlls/bot/cs_bot_chatter.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/bot/cs_bot_chatter.cpp b/regamedll/dlls/bot/cs_bot_chatter.cpp index eae1f92a..6a902bdb 100644 --- a/regamedll/dlls/bot/cs_bot_chatter.cpp +++ b/regamedll/dlls/bot/cs_bot_chatter.cpp @@ -1589,11 +1589,21 @@ bool BotChatterInterface::ShouldSpeak() const float BotChatterInterface::GetRadioSilenceDuration() { - return IMPL(m_radioSilenceInterval)[ m_me->m_iTeam - 1 ].GetElapsedTime(); +#ifdef REGAMEDLL_FIXES + if (m_me->m_iTeam != CT && m_me->m_iTeam != TERRORIST) + return 0; +#endif + + return IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].GetElapsedTime(); } void BotChatterInterface::ResetRadioSilenceDuration() { +#ifdef REGAMEDLL_FIXES + if (m_me->m_iTeam != CT && m_me->m_iTeam != TERRORIST) + return; +#endif + IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].Reset(); }