Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94ee356

Browse files
committed
fixup
1 parent 2f8395b commit 94ee356

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/web/websocket/receiver.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const {
1212
websocketMessageReceived,
1313
utf8Decode,
1414
isControlFrame,
15-
isTextBinaryFrame
15+
isTextBinaryFrame,
16+
isContinuationFrame
1617
} = require('./util')
1718
const { WebsocketFrameSend } = require('./frame')
1819
const { closeWebSocketConnection } = require('./connection')
@@ -121,6 +122,11 @@ class ByteParser extends Writable {
121122
return
122123
}
123124

125+
if (isContinuationFrame(opcode) && this.#fragments.length === 0) {
126+
failWebsocketConnection(this.ws, 'Unexpected continuation frame')
127+
return
128+
}
129+
124130
if (payloadLength <= 125) {
125131
this.#info.payloadLength = payloadLength
126132
this.#state = parserStates.READ_DATA

0 commit comments

Comments
 (0)