Add safe check on player colour packet, and return early if team packet check fails.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3561 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-01-27 15:09:41 +00:00
parent 6f2d7fce48
commit 81633326db
1 changed files with 8 additions and 0 deletions

View File

@ -1025,6 +1025,7 @@ BOOL recvTeamRequest()
{ {
debug(LOG_ERROR, "Invalid NET_TEAMREQUEST from player %d: Tried to change player %d (team %d)", debug(LOG_ERROR, "Invalid NET_TEAMREQUEST from player %d: Tried to change player %d (team %d)",
NETgetSource(), (int)player, (int)team); NETgetSource(), (int)player, (int)team);
return FALSE;
} }
changeTeam(player, team); changeTeam(player, team);
@ -1107,6 +1108,13 @@ BOOL recvColourRequest()
NETuint8_t(&chosenPlayer); NETuint8_t(&chosenPlayer);
NETend(); NETend();
if (player > MAX_PLAYERS || chosenPlayer > MAX_PLAYERS)
{
debug(LOG_ERROR, "Invalid NET_COLOURREQUEST from player %d: Tried to change player %d to %d",
NETgetSource(), (int)player, (int)chosenPlayer);
return FALSE;
}
return changeColour(player, col, chosenPlayer); return changeColour(player, col, chosenPlayer);
} }