diff --git a/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/EaglerSPRelay.java b/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/EaglerSPRelay.java index f8659af..96e18a8 100644 --- a/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/EaglerSPRelay.java +++ b/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/EaglerSPRelay.java @@ -288,7 +288,7 @@ public class EaglerSPRelay extends WebSocketServer { String code = ipkt.connectionCode; logger.debug("[{}]: Connected as a client, requested server code: {}", (String) arg0.getAttachment(), code); if(code.length() != config.getCodeLength()) { - logger.debug("The code '{}' is invalid because it's the wrong length, disconnecting"); + logger.debug("The code '{}' is invalid because it's the wrong length, disconnecting", code); arg0.send(IPacket.writePacket(new IPacketFFErrorCode(IPacketFFErrorCode.TYPE_CODE_LENGTH, "The join code is the wrong length, it should be " + config.getCodeLength() + " chars long"))); arg0.close(); diff --git a/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java b/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java index ac58468..c38f3c1 100644 --- a/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java +++ b/sp-relay/src/main/java/net/lax1dude/eaglercraft/sp/relay/pkt/IPacket.java @@ -44,6 +44,10 @@ public class IPacket { } IPacket pkt = clazz.newInstance(); pkt.read(input); + int j = input.available(); + if(j > 0) { + throw new IOException("Packet type " + i + " had " + j + " remaining bytes"); + } return pkt; } catch (InstantiationException | IllegalAccessException e) { EaglerSPRelay.logger.error("Could not instanciate packet {}", i); diff --git a/stable-download/sp-relay.jar b/stable-download/sp-relay.jar index b19c1f3..f1670b9 100644 Binary files a/stable-download/sp-relay.jar and b/stable-download/sp-relay.jar differ