diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index fa158b1d4..936c26395 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1438,9 +1438,14 @@ int CServer::Run() void CServer::ConKick(IConsole::IResult *pResult, void *pUser, int ClientId) { int ClientId1 = pResult->GetInteger(0); - if (ClientId == -1 || ((CServer *)pUser)->m_aClients[ClientId].m_Authed > ((CServer *)pUser)->m_aClients[ClientId1].m_Authed) + char buf[128]; + if(ClientId1 < 0 || ClientId1 >= MAX_CLIENTS || m_aClients[ClientId1].m_State == CClient::STATE_EMPTY) + { + str_format(buf, sizeof(buf),"Invalid Client ID %d", ClientId1); + ((CServer *)pUser)->SendRconLine(ClientId,buf); + } + else if (ClientId == -1 || ((CServer *)pUser)->m_aClients[ClientId].m_Authed > ((CServer *)pUser)->m_aClients[ClientId1].m_Authed) { - char buf[128]; str_format(buf, sizeof(buf),"Kicked by %s", ((CServer *)pUser)->ClientName(ClientId)); ((CServer *)pUser)->Kick(ClientId1, buf); } diff --git a/src/game/collision.cpp b/src/game/collision.cpp index fcd937d9b..936fdfafe 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -241,14 +241,14 @@ void CCollision::SetCollisionAt(float x, float y, int flag) void CCollision::SetDTile(float x, float y, int Team, bool State) { - if(!m_pDoor || ((Team < 0 || Team > MAX_CLIENTS) && Team !=99)) + if(!m_pDoor || ((Team < 0 || Team > (MAX_CLIENTS - 1)) && Team !=99)) return; int nx = clamp(round(x)/32, 0, m_Width-1); int ny = clamp(round(y)/32, 0, m_Height-1); if(Team == 99) { - for (int i = 0; i < MAX_CLIENTS; ++i) + for (int i = 0; i < (MAX_CLIENTS - 1); ++i) { m_pDoor[ny * m_Width + nx].m_Team[i] = State; } @@ -259,7 +259,7 @@ void CCollision::SetDTile(float x, float y, int Team, bool State) void CCollision::SetDCollisionAt(float x, float y, int Flag, int Team) { - if(!m_pDoor || ((Team < 0 || Team > MAX_CLIENTS) && Team !=99)) + if(!m_pDoor || ((Team < 0 || Team > (MAX_CLIENTS - 1)) && Team !=99)) return; int nx = clamp(round(x)/32, 0, m_Width-1); int ny = clamp(round(y)/32, 0, m_Height-1); @@ -267,7 +267,7 @@ void CCollision::SetDCollisionAt(float x, float y, int Flag, int Team) m_pDoor[ny * m_Width + nx].m_Index = Flag; if(Team == 99) { - for (int i = 0; i < MAX_CLIENTS; ++i) + for (int i = 0; i < (MAX_CLIENTS - 1); ++i) { m_pDoor[ny * m_Width + nx].m_Team[i] = true; } @@ -278,10 +278,8 @@ void CCollision::SetDCollisionAt(float x, float y, int Flag, int Team) int CCollision::GetDTileIndex(int Index,int Team) { - if(!m_pDoor || !m_pDoor[Index].m_Index || ((Team < 0 || Team > MAX_CLIENTS) && Team !=99)) - { + if(!m_pDoor || !m_pDoor[Index].m_Index || ((Team < 0 || Team > (MAX_CLIENTS - 1)) && Team !=99)) return 0; - } if(m_pDoor[Index].m_Team[Team]) return m_pDoor[Index].m_Index;