Skip to content

Commit

Permalink
fix issue with payload transfer and potential overread due to array p…
Browse files Browse the repository at this point in the history
…ool buffer size
  • Loading branch information
mregen committed Jul 4, 2024
1 parent d60c7c0 commit a3fb0fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/MQTTnet/Adapter/MqttChannelAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ async Task<ReceivedMqttPacket> ReceiveAsync(CancellationToken cancellationToken)
var bodyArray = mqttPacket.Body.Array;
do
{
var bytesLeft = bodyArray.Length - bodyOffset;
var bytesLeft = bodyLength - bodyOffset;
if (chunkSize > bytesLeft)
{
chunkSize = bytesLeft;
Expand Down
2 changes: 1 addition & 1 deletion Source/MQTTnet/Buffers/MqttPayloadOwner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MQTTnet.Buffers
/// Owner of <see cref="ReadOnlySequence{T}"/> that is responsible
/// for disposing the underlying payload appropriately.
/// </summary>
public struct MqttPayloadOwner<T> : IReadOnlySequenceOwner<T>
public class MqttPayloadOwner<T> : IReadOnlySequenceOwner<T>
{
public MqttPayloadOwner()
{
Expand Down

0 comments on commit a3fb0fa

Please sign in to comment.