fix: Fixes crashing due to bad packet assumptions. (#1829)
### Summary - Fixes various exploits that can crash the shard when the client misbehaves. - Clients will now be disconnected if they send packets that are marked as out of game only (new flag), while they are in-game. > [!Note] > **Developer Note** > Added an `OutOfGameOnly` which should be used to flag packets as only available out of the game. > This is the opposite of, yet not the converse to `InGameOnly`.
This commit is contained in:
parent
2429b00638
commit
6f444488a5
10 changed files with 113 additions and 46 deletions
|
|
@ -14,6 +14,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
|
|
@ -27,8 +28,14 @@ namespace Server.Network
|
|||
_handlers = ProtocolExtensions<FreeshardProtocolInfo>.Register(new FreeshardProtocolInfo());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void Register(int cmd, bool ingame, delegate*<NetState, SpanReader, void> onReceive) =>
|
||||
_handlers[cmd] = new PacketHandler(cmd, 0, ingame, onReceive);
|
||||
Register(cmd, ingame, false, onReceive);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void Register(
|
||||
int cmd, bool ingame, bool outgame, delegate*<NetState, SpanReader, void> onReceive
|
||||
) => _handlers[cmd] = new PacketHandler(cmd, onReceive, inGameOnly: ingame, outGameOnly: outgame);
|
||||
|
||||
private struct FreeshardProtocolInfo : IProtocolExtensionsInfo
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue