Fix calculation of remaining length parameter for websockets clients.

Only affects those clients that send fragmented packets.

Closes #1974. Thanks to 贺亚东.
pull/2017/head
Roger A. Light 5 years ago
parent e78c04de9b
commit 695bbc33c8

@ -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
==================

@ -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));

Loading…
Cancel
Save