Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions System.Net.WebSockets.Client.Managed/ManagedWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ private async Task<WebSocketReceiveResult> ReceiveAsyncPrivate(ArraySegment<byte

// If this a text message, validate that it contains valid UTF8.
if (header.Opcode == MessageOpcode.Text &&
!TryValidateUtf8(new ArraySegment<byte>(payloadBuffer.Array, payloadBuffer.Offset, bytesToCopy), header.Fin, _utf8TextState))
!TryValidateUtf8(new ArraySegment<byte>(payloadBuffer.Array, payloadBuffer.Offset, bytesToCopy), header.Fin && header.PayloadLength == 0, _utf8TextState))
{
await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.InvalidPayloadData, WebSocketError.Faulted, cancellationToken).ConfigureAwait(false);
}
Expand Down Expand Up @@ -1415,4 +1415,4 @@ private struct MessageHeader
internal int Mask;
}
}
}
}