From 8f5abf79839fa288c037f8d6c03977f8ac806fcc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 14 Jul 2013 16:51:50 +1200 Subject: [PATCH 1/4] Give the airdrop C17 enough room to land. Fixes #3554. --- OpenRA.Mods.Cnc/ProductionAirdrop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Cnc/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/ProductionAirdrop.cs index 6fca74b5e5..1b5ce4a429 100644 --- a/OpenRA.Mods.Cnc/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/ProductionAirdrop.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Cnc 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(() => { From 330978aeea90643c17ab5cf440e3a0f8baf07d76 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 14 Jul 2013 16:56:44 +1200 Subject: [PATCH 2/4] Fix ProductionAirdrop style nits. --- OpenRA.Mods.Cnc/ProductionAirdrop.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Cnc/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/ProductionAirdrop.cs index 1b5ce4a429..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,10 +54,10 @@ 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(9, 0))); From 57a27eb9487a94e0e67daa3271ec1a997b307a71 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 14 Jul 2013 16:58:10 +1200 Subject: [PATCH 3/4] Restore packet size restriction with 128k limit. --- OpenRA.Game/Server/Connection.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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: From c7c9b8710e2f5fd780771efee76acbdaa896d864 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 14 Jul 2013 17:05:13 +1200 Subject: [PATCH 4/4] Fix cached paths in PathFinder. Fixes #3557. --- OpenRA.Mods.RA/Move/PathFinder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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();