mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/LFG: Sanitize LFG roles sent by clients
(cherry picked from commit 3778f23c57)
This commit is contained in:
@@ -40,7 +40,8 @@ enum LfgRoles
|
||||
PLAYER_ROLE_LEADER = 0x01,
|
||||
PLAYER_ROLE_TANK = 0x02,
|
||||
PLAYER_ROLE_HEALER = 0x04,
|
||||
PLAYER_ROLE_DAMAGE = 0x08
|
||||
PLAYER_ROLE_DAMAGE = 0x08,
|
||||
PLAYER_ROLE_ANY = PLAYER_ROLE_LEADER | PLAYER_ROLE_TANK | PLAYER_ROLE_HEALER | PLAYER_ROLE_DAMAGE
|
||||
};
|
||||
|
||||
enum LfgUpdateType
|
||||
|
||||
@@ -397,6 +397,13 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
|
||||
if (!player || !player->GetSession() || dungeons.empty())
|
||||
return;
|
||||
|
||||
// At least 1 role must be selected
|
||||
if (!(roles & (PLAYER_ROLE_TANK | PLAYER_ROLE_HEALER | PLAYER_ROLE_DAMAGE)))
|
||||
return;
|
||||
|
||||
// Sanitize input roles
|
||||
roles &= PLAYER_ROLE_ANY;
|
||||
|
||||
Group* grp = player->GetGroup();
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
ObjectGuid gguid = grp ? grp->GetGUID() : guid;
|
||||
@@ -716,6 +723,9 @@ void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::
|
||||
if (itRoleCheck == RoleChecksStore.end())
|
||||
return;
|
||||
|
||||
// Sanitize input roles
|
||||
roles &= PLAYER_ROLE_ANY;
|
||||
|
||||
LfgRoleCheck& roleCheck = itRoleCheck->second;
|
||||
bool sendRoleChosen = roleCheck.state != LFG_ROLECHECK_DEFAULT && !guid.IsEmpty();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user