Merge pull request #148 from ACE1046/master
Message type check in readSubscription (#147)
This commit is contained in:
commit
b7838a3278
@ -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