mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-04-15 20:15:49 +02:00
check for length before encoding varint frame
This commit is contained in:
parent
56a1495b12
commit
c7a126cf61
@ -162,6 +162,7 @@ class FrameCodec : ByteToMessageCodec<ByteBuf>() {
|
||||
}
|
||||
|
||||
override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) {
|
||||
if (msg.readableBytes() >= 2097152) throw badLength
|
||||
Type.VAR_INT.writePrimitive(out, msg.readableBytes())
|
||||
out.writeBytes(msg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user