Message type check in readSubscription (#147)
Added message type checking in readSubscription https://github.com/adafruit/Adafruit_MQTT_Library/issues/147
This commit is contained in:
parent
493a1cf590
commit
417d342078
@ -463,6 +463,9 @@ Adafruit_MQTT_Subscribe *Adafruit_MQTT::readSubscription(int16_t timeout) {
|
|||||||
DEBUG_PRINT("Packet len: "); DEBUG_PRINTLN(len);
|
DEBUG_PRINT("Packet len: "); DEBUG_PRINTLN(len);
|
||||||
DEBUG_PRINTBUFFER(buffer, len);
|
DEBUG_PRINTBUFFER(buffer, len);
|
||||||
|
|
||||||
|
if (len<3) return NULL;
|
||||||
|
if ((buffer[0] & 0xF0) != (MQTT_CTRL_PUBLISH) << 4) return NULL;
|
||||||
|
|
||||||
// Parse out length of packet.
|
// Parse out length of packet.
|
||||||
topiclen = buffer[3];
|
topiclen = buffer[3];
|
||||||
DEBUG_PRINT(F("Looking for subscription len ")); DEBUG_PRINTLN(topiclen);
|
DEBUG_PRINT(F("Looking for subscription len ")); DEBUG_PRINTLN(topiclen);
|
||||||
|
Loading…
Reference in New Issue
Block a user