net/mqtt: use rlen to calculate # of QoS items in SUBACK packet
The data->len of an inbound netbuf can be larger than a single MQTT packet. For instance when a PINGRESP is also included in the same netbuf. For this reason we should not be using the data->len to determine how large the rest of the MQTT data is. Specific Example: we've seen in testing that PINGRESP packets can be included with a SUBACK packet in the same netbuf. Under this case the current code uses the data->len incorrectly and tries to find 3 QoS elements for the SUBACK packet when there is only 1 (the rest of the data is for PINGRESP). NOTE: A larger patch to iterate through the netbuf data parsing individual MQTT packets will be needed to fix the MQTT subsys. This patch only corrects the SUBACK parsing. Change-Id: I7f6cebaaed9570b778d466de84331cf8c5060755 Signed-off-by: Michael Scott <michael.scott@linaro.org>
This commit is contained in:
parent
e5f1112b07
commit
fa5503fb44
1 changed files with 1 additions and 1 deletions
|
@ -815,7 +815,7 @@ int mqtt_unpack_suback(u8_t *buf, u16_t length, u16_t *pkt_id,
|
|||
*pkt_id = ntohs(val_u16);
|
||||
offset += PACKET_ID_SIZE;
|
||||
|
||||
*items = length - offset;
|
||||
*items = rlen - PACKET_ID_SIZE;
|
||||
|
||||
/* no enough space to store the QoS */
|
||||
if (*items > elements) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue