mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-31 19:25:14 +02:00
FIX: mqtt_get_id wrong logic on msg size checks.
This error was preventing the function from returning the right msg ID, returning always 0.
This commit is contained in:
committed by
David Cermak
parent
d159bf4575
commit
db71c753aa
@@ -307,13 +307,13 @@ uint16_t mqtt_get_id(uint8_t* buffer, uint16_t length)
|
|||||||
topiclen = buffer[i++] << 8;
|
topiclen = buffer[i++] << 8;
|
||||||
topiclen |= buffer[i++];
|
topiclen |= buffer[i++];
|
||||||
|
|
||||||
if (i + topiclen >= length)
|
if (i + topiclen > length)
|
||||||
return 0;
|
return 0;
|
||||||
i += topiclen;
|
i += topiclen;
|
||||||
|
|
||||||
if (mqtt_get_qos(buffer) > 0)
|
if (mqtt_get_qos(buffer) > 0)
|
||||||
{
|
{
|
||||||
if (i + 2 >= length)
|
if (i + 2 > length)
|
||||||
return 0;
|
return 0;
|
||||||
//i += 2;
|
//i += 2;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user