This commit is contained in:
Regalis11
2024-04-16 18:00:23 +03:00
parent 18af2754db
commit 536346da11
9 changed files with 24 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using Barotrauma.Extensions;
using Barotrauma.Steam;
using System;
@@ -152,7 +152,16 @@ namespace Barotrauma.Networking
if (packetHeader.IsConnectionInitializationStep())
{
ConnectionInitialization initialization = peerPacketHeaders.Initialization ?? throw new Exception("Initialization step missing");
if (peerPacketHeaders.Initialization == null)
{
//can happen if the packet is crafted in a way to leave the Initialization value as null
DebugConsole.ThrowErrorOnce(
$"P2POwnerPeer.OnP2PData:{remotePeer.Endpoint.StringRepresentation}",
$"Failed to initialize remote peer {remotePeer.Endpoint.StringRepresentation}: initialization step missing.");
CommunicateDisconnectToRemotePeer(remotePeer, PeerDisconnectPacket.WithReason(DisconnectReason.MalformedData));
return;
}
ConnectionInitialization initialization = peerPacketHeaders.Initialization.Value;
if (initialization == ConnectionInitialization.AuthInfoAndVersion
&& remotePeer.AuthStatus == RemotePeer.AuthenticationStatus.NotAuthenticated)
{

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.3.0.3</Version>
<Version>1.3.0.4</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.3.0.3</Version>
<Version>1.3.0.4</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.3.0.3</Version>
<Version>1.3.0.4</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.3.0.3</Version>
<Version>1.3.0.4</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.3.0.3</Version>
<Version>1.3.0.4</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.3.0.3</Version>
<Version>1.3.0.4</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -2615,7 +2615,7 @@ namespace Barotrauma
/// <summary>
/// Log the error message, but only if an error with the same identifier hasn't been thrown yet during this session.
/// </summary>
public static void ThrowErrorOnce(string identifier, string errorMsg, Exception e)
public static void ThrowErrorOnce(string identifier, string errorMsg, Exception e = null)
{
if (loggedErrorIdentifiers.Contains(identifier)) { return; }
ThrowError(errorMsg, e);

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------------------------------------------------------------------------------------
v1.3.0.4
-------------------------------------------------------------------------------------------------------------------------------------------------
- Fixed another exploit that allowed crashing servers by sending them specifically crafted malformed data.
-------------------------------------------------------------------------------------------------------------------------------------------------
v1.3.0.3
-------------------------------------------------------------------------------------------------------------------------------------------------