3142: Fix two more serverbrowser filter out of bounds r=def- a=Jupeyy



Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2020-10-18 20:32:32 +00:00 committed by GitHub
commit c04621ea43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,7 @@ void CServerBrowser::Filter()
{ {
Filtered = 1; Filtered = 1;
// match against player country // match against player country
for(p = 0; p < m_ppServerlist[i]->m_Info.m_NumClients; p++) for(p = 0; p < minimum(m_ppServerlist[i]->m_Info.m_NumClients, (int)MAX_CLIENTS); p++)
{ {
if(m_ppServerlist[i]->m_Info.m_aClients[p].m_Country == g_Config.m_BrFilterCountryIndex) if(m_ppServerlist[i]->m_Info.m_aClients[p].m_Country == g_Config.m_BrFilterCountryIndex)
{ {
@ -243,7 +243,7 @@ void CServerBrowser::Filter()
} }
// match against players // match against players
for(p = 0; p < m_ppServerlist[i]->m_Info.m_NumClients; p++) for(p = 0; p < minimum(m_ppServerlist[i]->m_Info.m_NumClients, (int)MAX_CLIENTS); p++)
{ {
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aName, g_Config.m_BrFilterString) || if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aName, g_Config.m_BrFilterString) ||
str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aClan, g_Config.m_BrFilterString)) str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aClan, g_Config.m_BrFilterString))