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:
Kamron Batman 2024-06-07 18:08:07 -07:00 committed by GitHub
parent 2429b00638
commit 6f444488a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 113 additions and 46 deletions

View file

@ -57,18 +57,17 @@ public static class IncomingAccountPackets
public static unsafe void Configure()
{
IncomingPackets.Register(0x00, 104, false, &CreateCharacter);
IncomingPackets.Register(0x5D, 73, false, &PlayCharacter);
IncomingPackets.Register(0x80, 62, false, &AccountLogin);
IncomingPackets.Register(0x83, 39, false, &DeleteCharacter);
IncomingPackets.Register(0x91, 65, false, &GameLogin);
IncomingPackets.Register(0xA0, 3, false, &PlayServer);
IncomingPackets.Register(0xBB, 9, false, &AccountID);
IncomingPackets.Register(0xBD, 0, false, &ClientVersion);
IncomingPackets.Register(0xCF, 0, false, &AccountLogin);
IncomingPackets.Register(0xE1, 0, false, &ClientType);
IncomingPackets.Register(0xEF, 21, false, &LoginServerSeed);
IncomingPackets.Register(0xF8, 106, false, &CreateCharacter);
IncomingPackets.Register(0x00, &CreateCharacter, 104, outgameOnly: true);
IncomingPackets.Register(0x5D, &PlayCharacter, 73, outgameOnly: true);
IncomingPackets.Register(0x80, &AccountLogin, 62, outgameOnly: true);
IncomingPackets.Register(0x83, &DeleteCharacter, 39, outgameOnly: true);
IncomingPackets.Register(0x91, &GameLogin, 65, outgameOnly: true);
IncomingPackets.Register(0xA0, &PlayServer, 3, outgameOnly: true);
IncomingPackets.Register(0xBD, &ClientVersion);
IncomingPackets.Register(0xCF, &AccountLogin, outgameOnly: true);
IncomingPackets.Register(0xE1, &ClientType);
IncomingPackets.Register(0xEF, &LoginServerSeed, 21, outgameOnly: true);
IncomingPackets.Register(0xF8, &CreateCharacter, 106, outgameOnly: true);
}
public static void CreateCharacter(NetState state, SpanReader reader)