File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/Microsoft.AspNet.WebSockets.Protocol Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,15 @@ private async Task ReadNextFrameAsync(CancellationToken cancellationToken)
299299
300300 if ( _frameInProgress . OpCode == Constants . OpCodes . PingFrame || _frameInProgress . OpCode == Constants . OpCodes . PongFrame )
301301 {
302+ if ( _frameBytesRemaining > 125 )
303+ {
304+ if ( State == WebSocketState . Open )
305+ {
306+ await CloseOutputAsync ( WebSocketCloseStatus . ProtocolError , "Invalid control frame size" , cancellationToken ) ;
307+ Abort ( ) ;
308+ }
309+ throw new InvalidOperationException ( "Control frame too large." ) ; // TODO: WebSocketException
310+ }
302311 // Drain it, should be less than 125 bytes
303312 await EnsureDataAvailableOrReadAsync ( ( int ) _frameBytesRemaining , cancellationToken ) ;
304313
You can’t perform that action at this time.
0 commit comments