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:
João Cabral
2019-04-18 14:32:01 +01:00
committed by David Cermak
parent d159bf4575
commit db71c753aa

View File

@ -307,13 +307,13 @@ uint16_t mqtt_get_id(uint8_t* buffer, uint16_t length)
topiclen = buffer[i++] << 8;
topiclen |= buffer[i++];
if (i + topiclen >= length)
if (i + topiclen > length)
return 0;
i += topiclen;
if (mqtt_get_qos(buffer) > 0)
{
if (i + 2 >= length)
if (i + 2 > length)
return 0;
//i += 2;
} else {