1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Validate peep game command which caused crash from invalid sprite index

This commit is contained in:
zsilencer
2016-10-22 01:53:33 -06:00
parent b184a16d8c
commit e2e4201112
2 changed files with 4 additions and 4 deletions

View File

@@ -1228,7 +1228,7 @@ void Network::RemoveClient(std::unique_ptr<NetworkConnection>& connection)
rct_peep* pickup_peep = network_get_pickup_peep(connection_player->id);
if(pickup_peep) {
game_command_playerid = connection_player->id;
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 1, 0, pickup_peep->type == PEEP_TYPE_GUEST ? GAME_COMMAND_PICKUP_GUEST : GAME_COMMAND_PICKUP_STAFF, network_get_pickup_peep_old_x(connection_player->id), 0);
game_do_command(pickup_peep->sprite_index, GAME_COMMAND_FLAG_APPLY, 1, 0, pickup_peep->type == PEEP_TYPE_GUEST ? GAME_COMMAND_PICKUP_GUEST : GAME_COMMAND_PICKUP_STAFF, network_get_pickup_peep_old_x(connection_player->id), 0);
}
gNetwork.Server_Send_EVENT_PLAYER_DISCONNECTED((char*)connection_player->name.c_str(), connection->GetLastDisconnectReason());
}

View File

@@ -1993,11 +1993,11 @@ bool peep_pickup_place(rct_peep* peep, int x, int y, int z, bool apply)
bool peep_pickup_command(int peepnum, int x, int y, int z, int action, bool apply)
{
rct_peep* peep = GET_PEEP(peepnum);
if (!peep || peep->sprite_identifier != SPRITE_IDENTIFIER_PEEP) {
return false;
}
switch (action) {
case 0: // pickup
if (!peep) {
return false;
}
if (!peep_can_be_picked_up(peep)) {
return false;
}