mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Do proper checks if Client Instance is valid
This commit is contained in:
parent
ac55e6c142
commit
0463647268
@ -170,18 +170,16 @@ void CBanSystem::BanListCheck(void)
|
|||||||
{
|
{
|
||||||
for (int c = 0; c < MAX_PLAYERS; c++) // Loop through all possible client instances.
|
for (int c = 0; c < MAX_PLAYERS; c++) // Loop through all possible client instances.
|
||||||
{
|
{
|
||||||
CClient* pClient = g_pClient->GetClient(c);
|
CClient* pClient = g_pClient->GetClient(i);
|
||||||
CNetChan* pNetChan = pClient->GetNetChan();
|
if (!pClient)
|
||||||
|
continue;
|
||||||
if (!pClient || !pNetChan)
|
|
||||||
{
|
CNetChan* pNetChan = pClient->GetNetChan();
|
||||||
|
if (!pNetChan)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (pClient->GetOriginID() != m_vRefuseList[i].second)
|
if (pClient->GetOriginID() != m_vRefuseList[i].second)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
string svIpAddress = pNetChan->GetAddress();
|
string svIpAddress = pNetChan->GetAddress();
|
||||||
|
|
||||||
|
@ -80,11 +80,12 @@ void Host_Kick_f(const CCommand& args)
|
|||||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
CClient* pClient = g_pClient->GetClient(i);
|
CClient* pClient = g_pClient->GetClient(i);
|
||||||
CNetChan* pNetChan = pClient->GetNetChan();
|
if (!pClient)
|
||||||
if (!pClient || !pNetChan)
|
continue;
|
||||||
{
|
|
||||||
|
CNetChan* pNetChan = pClient->GetNetChan();
|
||||||
|
if (!pNetChan)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
string svClientName = pNetChan->GetName(); // Get full name.
|
string svClientName = pNetChan->GetName(); // Get full name.
|
||||||
|
|
||||||
@ -120,12 +121,12 @@ void Host_KickID_f(const CCommand& args)
|
|||||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
CClient* pClient = g_pClient->GetClient(i);
|
CClient* pClient = g_pClient->GetClient(i);
|
||||||
CNetChan* pNetChan = pClient->GetNetChan();
|
if (!pClient)
|
||||||
|
continue;
|
||||||
if (!pClient || !pNetChan)
|
|
||||||
{
|
CNetChan* pNetChan = pClient->GetNetChan();
|
||||||
|
if (!pNetChan)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
string svIpAddress = pNetChan->GetAddress(); // If this stays null they modified the packet somehow.
|
string svIpAddress = pNetChan->GetAddress(); // If this stays null they modified the packet somehow.
|
||||||
|
|
||||||
@ -184,12 +185,12 @@ void Host_Ban_f(const CCommand& args)
|
|||||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
CClient* pClient = g_pClient->GetClient(i);
|
CClient* pClient = g_pClient->GetClient(i);
|
||||||
CNetChan* pNetChan = pClient->GetNetChan();
|
if (!pClient)
|
||||||
|
continue;
|
||||||
if (!pClient || !pNetChan)
|
|
||||||
{
|
CNetChan* pNetChan = pClient->GetNetChan();
|
||||||
|
if (!pNetChan)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
string svClientName = pNetChan->GetName(); // Get full name.
|
string svClientName = pNetChan->GetName(); // Get full name.
|
||||||
|
|
||||||
@ -229,12 +230,12 @@ void Host_BanID_f(const CCommand& args)
|
|||||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
CClient* pClient = g_pClient->GetClient(i);
|
CClient* pClient = g_pClient->GetClient(i);
|
||||||
CNetChan* pNetChan = pClient->GetNetChan();
|
if (!pClient)
|
||||||
|
continue;
|
||||||
if (!pClient || !pNetChan)
|
|
||||||
{
|
CNetChan* pNetChan = pClient->GetNetChan();
|
||||||
|
if (!pNetChan)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
string svIpAddress = pNetChan->GetAddress(); // If this stays empty they modified the packet somehow.
|
string svIpAddress = pNetChan->GetAddress(); // If this stays empty they modified the packet somehow.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user