Conformity

This commit is contained in:
Shane Freeder
2026-01-08 17:13:08 +00:00
parent a03bd884aa
commit 372a3b28bd

View File

@@ -76,13 +76,13 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
}
// skip any runs of 0x00 we might find
int wLength = in.readableBytes();
int wlen = in.readableBytes();
int packetStart = in.forEachByte(FIND_NON_NUL);
if (packetStart == -1) {
in.clear();
// Apply a more strict check in serverbound direction, we really shouldn't be seeing this many 0x00s
// even from the server, the only reason we even allow these is due to bugged servers
if (direction == ProtocolUtils.Direction.SERVERBOUND && wLength > 16) {
if (direction == ProtocolUtils.Direction.SERVERBOUND && wlen > 16) {
throw INVALID_PREAMBLE;
}
return;