We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a5dbcc commit 207767aCopy full SHA for 207767a
src/Microsoft.AspNet.WebSockets.Protocol/CommonWebSocket.cs
@@ -299,6 +299,15 @@ private async Task ReadNextFrameAsync(CancellationToken cancellationToken)
299
300
if (_frameInProgress.OpCode == Constants.OpCodes.PingFrame || _frameInProgress.OpCode == Constants.OpCodes.PongFrame)
301
{
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
311
// Drain it, should be less than 125 bytes
312
await EnsureDataAvailableOrReadAsync((int)_frameBytesRemaining, cancellationToken);
313
0 commit comments