Browse Source

Fixed latent bug in MqttApplicationMessageBuilder.WithPayload stream overload (#1322)

release/3.x.x
Günther Foidl 3 years ago
committed by GitHub
parent
commit
d98129481a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      Source/MQTTnet/MqttApplicationMessageBuilder.cs

+ 12
- 1
Source/MQTTnet/MqttApplicationMessageBuilder.cs View File

@@ -159,7 +159,18 @@ namespace MQTTnet
else
{
_payload = new byte[length];
payload.Read(_payload, 0, _payload.Length);

var totalRead = 0;
do
{
var bytesRead = payload.Read(_payload, totalRead, _payload.Length - totalRead);
if (bytesRead == 0)
{
break;
}
totalRead += bytesRead;
}
while (totalRead < length);
}

return this;


Loading…
Cancel
Save