Skip to content

Commit

Permalink
Remove exception when reciveing large RCON packets
Browse files Browse the repository at this point in the history
It does not make sense to throw an exception because the server sends
a too large response. While technicaly it breaks the spec, we can handle it
gracefully and it works better than the old Multi Packet RCON tricks.
Thanks @arildboifot for letting me know!
Relates to: #45
  • Loading branch information
xobust committed Oct 26, 2023
1 parent 775ed63 commit 47c1b28
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/CoreRCON/PacketFormats/RCONPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ internal static RCONPacket FromBytes(byte[] buffer)
{
if (buffer == null) throw new NullReferenceException("Byte buffer cannot be null.");
if (buffer.Length < 4) throw new InvalidDataException("Buffer does not contain a size field.");
if (buffer.Length > Constants.MAX_PACKET_SIZE) throw new InvalidDataException("Buffer is too large for an RCON packet.");

int size = BitConverter.ToInt32(buffer, 0);
if (size > buffer.Length - 4) throw new InvalidDataException("Packet size specified was larger then buffer");
Expand Down

0 comments on commit 47c1b28

Please sign in to comment.