Core/LFG: Sanitize LFG roles sent by clients
Port From (https://github.com/TrinityCore/TrinityCore/commit/4431df1f136372319dd6f73c4d28c4e0ef0dcb2c)
This commit is contained in:
@@ -26,7 +26,8 @@ namespace Framework.Constants
|
||||
Leader = 0x01,
|
||||
Tank = 0x02,
|
||||
Healer = 0x04,
|
||||
Damage = 0x08
|
||||
Damage = 0x08,
|
||||
Any = Leader | Tank | Healer | Damage
|
||||
}
|
||||
|
||||
public enum LfgUpdateType
|
||||
|
||||
@@ -357,6 +357,13 @@ namespace Game.DungeonFinding
|
||||
if (!player || player.GetSession() == null || dungeons.Empty())
|
||||
return;
|
||||
|
||||
// At least 1 role must be selected
|
||||
if ((roles & (LfgRoles.Tank | LfgRoles.Healer | LfgRoles.Damage)) == 0)
|
||||
return;
|
||||
|
||||
// Sanitize input roles
|
||||
roles &= LfgRoles.Any;
|
||||
|
||||
Group grp = player.GetGroup();
|
||||
ObjectGuid guid = player.GetGUID();
|
||||
ObjectGuid gguid = grp ? grp.GetGUID() : guid;
|
||||
@@ -669,6 +676,9 @@ namespace Game.DungeonFinding
|
||||
if (roleCheck == null)
|
||||
return;
|
||||
|
||||
// Sanitize input roles
|
||||
roles &= LfgRoles.Any;
|
||||
|
||||
bool sendRoleChosen = roleCheck.state != LfgRoleCheckState.Default && !guid.IsEmpty();
|
||||
|
||||
if (guid.IsEmpty())
|
||||
|
||||
Reference in New Issue
Block a user