Core/LFG: Sanitize LFG roles sent by clients

Port From (https://github.com/TrinityCore/TrinityCore/commit/4431df1f136372319dd6f73c4d28c4e0ef0dcb2c)
This commit is contained in:
hondacrx
2022-02-23 16:37:25 -05:00
parent 3fb2429495
commit 43726e7da0
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -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
+10
View File
@@ -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())