mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
handling of broken packets
This commit is contained in:
parent
11f95213d3
commit
3d5a1249da
@ -136,15 +136,14 @@ public class Network {
|
|||||||
while (binQueueIn.size() > 0) {
|
while (binQueueIn.size() > 0) {
|
||||||
|
|
||||||
// read data
|
// read data
|
||||||
byte[] raw = binQueueIn.get(0);
|
byte[] decrypted = binQueueIn.get(0);
|
||||||
InPacketBuffer inPacketBuffer;
|
InPacketBuffer inPacketBuffer;
|
||||||
if (encryptionEnabled) {
|
if (encryptionEnabled) {
|
||||||
// decrypt
|
// decrypt
|
||||||
byte[] decrypted = cipherDecrypt.update(raw);
|
decrypted = cipherDecrypt.update(decrypted);
|
||||||
inPacketBuffer = new InPacketBuffer(decrypted);
|
|
||||||
} else {
|
|
||||||
inPacketBuffer = new InPacketBuffer(raw);
|
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
inPacketBuffer = new InPacketBuffer(decrypted);
|
||||||
Packets.Clientbound p = connection.getVersion().getProtocol().getPacketByCommand(connection.getConnectionState(), inPacketBuffer.getCommand());
|
Packets.Clientbound p = connection.getVersion().getProtocol().getPacketByCommand(connection.getConnectionState(), inPacketBuffer.getCommand());
|
||||||
Class<? extends ClientboundPacket> clazz = Protocol.getPacketByPacket(p);
|
Class<? extends ClientboundPacket> clazz = Protocol.getPacketByPacket(p);
|
||||||
|
|
||||||
@ -161,6 +160,10 @@ public class Network {
|
|||||||
// safety first, but will not occur
|
// safety first, but will not occur
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
Log.protocol("Received broken packet!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
binQueueIn.remove(0);
|
binQueueIn.remove(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user