#15 - Validate ping frame size limits.
This commit is contained in:
parent
4a5dbccb46
commit
207767a9b0
|
|
@ -299,6 +299,15 @@ namespace Microsoft.AspNet.WebSockets.Protocol
|
||||||
|
|
||||||
if (_frameInProgress.OpCode == Constants.OpCodes.PingFrame || _frameInProgress.OpCode == Constants.OpCodes.PongFrame)
|
if (_frameInProgress.OpCode == Constants.OpCodes.PingFrame || _frameInProgress.OpCode == Constants.OpCodes.PongFrame)
|
||||||
{
|
{
|
||||||
|
if (_frameBytesRemaining > 125)
|
||||||
|
{
|
||||||
|
if (State == WebSocketState.Open)
|
||||||
|
{
|
||||||
|
await CloseOutputAsync(WebSocketCloseStatus.ProtocolError, "Invalid control frame size", cancellationToken);
|
||||||
|
Abort();
|
||||||
|
}
|
||||||
|
throw new InvalidOperationException("Control frame too large."); // TODO: WebSocketException
|
||||||
|
}
|
||||||
// Drain it, should be less than 125 bytes
|
// Drain it, should be less than 125 bytes
|
||||||
await EnsureDataAvailableOrReadAsync((int)_frameBytesRemaining, cancellationToken);
|
await EnsureDataAvailableOrReadAsync((int)_frameBytesRemaining, cancellationToken);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue