]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add loadout group check (#28311)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 27 May 2024 08:04:34 +0000 (18:04 +1000)
committerGitHub <noreply@github.com>
Mon, 27 May 2024 08:04:34 +0000 (01:04 -0700)
Forgot to add it back in one of the rewrites.

Content.Shared/Preferences/Loadouts/RoleLoadout.cs

index 40e13f0edfa4dfd72c590fd4ca62b4588270fcfd..479974893ceb2adbec42e2dd5b9ba86274da183b 100644 (file)
@@ -78,12 +78,20 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
             {
                 var loadout = loadouts[i];
 
+                // Old prototype or otherwise invalid.
                 if (!protoManager.TryIndex(loadout.Prototype, out var loadoutProto))
                 {
                     loadouts.RemoveAt(i);
                     continue;
                 }
 
+                // Malicious client maybe, check the group even has it.
+                if (!groupProto.Loadouts.Contains(loadout.Prototype))
+                {
+                    loadouts.RemoveAt(i);
+                    continue;
+                }
+
                 // Validate the loadout can be applied (e.g. points).
                 if (!IsValid(profile, session, loadout.Prototype, collection, out _))
                 {