diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs index 76799ee660..79b3d88a7a 100644 --- a/OpenRA.Game/Server/Connection.cs +++ b/OpenRA.Game/Server/Connection.cs @@ -25,6 +25,7 @@ namespace OpenRA.Server public int ExpectLength = 8; public int Frame = 0; public int MostRecentFrame = 0; + public const int MaxOrderLength = 131072; /* client data */ public int PlayerIndex; @@ -65,7 +66,7 @@ namespace OpenRA.Server if (e.SocketErrorCode == SocketError.WouldBlock) break; server.DropClient(this); - Log.Write("server", "Dropping client {0} because reading the data failed: {1}", this.PlayerIndex.ToString(), e); + Log.Write("server", "Dropping client {0} because reading the data failed: {1}", PlayerIndex, e); return false; } } @@ -86,6 +87,13 @@ namespace OpenRA.Server ExpectLength = BitConverter.ToInt32(bytes, 0) - 4; Frame = BitConverter.ToInt32(bytes, 4); State = ReceiveState.Data; + + if (ExpectLength < 0 || ExpectLength > MaxOrderLength) + { + server.DropClient(this); + Log.Write("server", "Dropping client {0} for excessive order length = {1}", PlayerIndex, ExpectLength); + return; + } } break; case ReceiveState.Data: diff --git a/OpenRA.Mods.Cnc/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/ProductionAirdrop.cs index 6fca74b5e5..142ee657d9 100644 --- a/OpenRA.Mods.Cnc/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/ProductionAirdrop.cs @@ -30,9 +30,10 @@ namespace OpenRA.Mods.Cnc class ProductionAirdrop : Production { - public ProductionAirdrop(ProductionAirdropInfo info) : base(info) {} + public ProductionAirdrop(ProductionAirdropInfo info) + : base(info) { } - public override bool Produce( Actor self, ActorInfo producee ) + public override bool Produce(Actor self, ActorInfo producee) { var owner = self.Owner; @@ -53,13 +54,13 @@ namespace OpenRA.Mods.Cnc { var a = w.CreateActor(actorType, new TypeDictionary { - new LocationInit( startPos ), - new OwnerInit( owner ), - new FacingInit( 64 ), - new AltitudeInit( Rules.Info[actorType].Traits.Get().CruiseAltitude ), + new LocationInit(startPos), + new OwnerInit(owner), + new FacingInit(64), + new AltitudeInit(Rules.Info[actorType].Traits.Get().CruiseAltitude), }); - a.QueueActivity(Fly.ToCell(self.Location + new CVec(6, 0))); + a.QueueActivity(Fly.ToCell(self.Location + new CVec(9, 0))); a.QueueActivity(new Land(Target.FromActor(self))); a.QueueActivity(new CallFunc(() => { diff --git a/OpenRA.Mods.RA/Move/PathFinder.cs b/OpenRA.Mods.RA/Move/PathFinder.cs index 037f312cfb..959e2cecf7 100755 --- a/OpenRA.Mods.RA/Move/PathFinder.cs +++ b/OpenRA.Mods.RA/Move/PathFinder.cs @@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA.Move Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.FrameNumber - cached.tick); if (world.FrameNumber - cached.tick > MaxPathAge) CachedPaths.Remove(cached); - return emptyPath; + return new List(cached.result); } var mi = self.Info.Traits.Get();