Fix #10263, ccefa76: [scripts] restore tile validation for commands (#10269)

This commit is contained in:
Loïc Guilloux
2022-12-21 02:37:59 +01:00
committed by GitHub
parent a857ed8240
commit c179c10048
3 changed files with 5 additions and 0 deletions

View File

@@ -333,6 +333,9 @@ bool ScriptObject::ScriptDoCommandHelper<Tcmd, Tret(*)(DoCommandFlag, Targs...)>
tile = std::get<0>(args);
}
/* Do not even think about executing out-of-bounds tile-commands. */
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (GetCommandFlags<Tcmd>() & CMD_ALL_TILES) == 0))) return false;
/* Only set ClientID parameters when the command does not come from the network. */
if constexpr ((::GetCommandFlags<Tcmd>() & CMD_CLIENT_ID) != 0) ScriptObjectInternal::SetClientIds(args, std::index_sequence_for<Targs...>{});