Fix calculation of remaining length parameter for websockets clients.

Only affects those clients that send fragmented packets.

Closes #1974. Thanks to 贺亚东.
This commit is contained in:
Roger A. Light 2021-01-12 10:22:04 +00:00
parent e78c04de9b
commit 695bbc33c8
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2.0.6 - 2021-01-xx
==================
Broker:
- Fix calculation of remaining length parameter for websockets clients that
send fragmented packets. Closes #1974.
2.0.5 - 2021-01-11
==================

View File

@ -332,7 +332,7 @@ static int callback_mqtt(
mosq->in_packet.remaining_length += (byte & 127) * mosq->in_packet.remaining_mult;
mosq->in_packet.remaining_mult *= 128;
}while((byte & 128) != 0);
mosq->in_packet.remaining_count = (int8_t)(mosq->in_packet.remaining_count -1);
mosq->in_packet.remaining_count = (int8_t)(mosq->in_packet.remaining_count * -1);
if(mosq->in_packet.remaining_length > 0){
mosq->in_packet.payload = mosquitto__malloc(mosq->in_packet.remaining_length*sizeof(uint8_t));