[#1879] Correctly validate close frame
This commit is contained in:
parent
aaafdf909d
commit
5a59cb9fb7
@ -443,10 +443,10 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocket08FrameDe
|
|||||||
/** */
|
/** */
|
||||||
protected void checkCloseFrameBody(
|
protected void checkCloseFrameBody(
|
||||||
ChannelHandlerContext ctx, ByteBuf buffer) {
|
ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||||
if (buffer == null || buffer.capacity() == 0) {
|
if (buffer == null || !buffer.isReadable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (buffer.capacity() == 1) {
|
if (buffer.readableBytes() == 1) {
|
||||||
protocolViolation(ctx, "Invalid close frame body");
|
protocolViolation(ctx, "Invalid close frame body");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +463,6 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocket08FrameDe
|
|||||||
|
|
||||||
// May have UTF-8 message
|
// May have UTF-8 message
|
||||||
if (buffer.isReadable()) {
|
if (buffer.isReadable()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new UTF8Output(buffer);
|
new UTF8Output(buffer);
|
||||||
} catch (UTF8Exception ex) {
|
} catch (UTF8Exception ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user