1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-07-08 14:01:58 +03:00

Merge pull request #148 from ACE1046/master

Message type check in readSubscription (#147)
This commit is contained in:
brentrubell
2019-04-16 11:49:27 -04:00
committed by GitHub

View File

@ -463,6 +463,9 @@ Adafruit_MQTT_Subscribe *Adafruit_MQTT::readSubscription(int16_t timeout) {
DEBUG_PRINT("Packet len: "); DEBUG_PRINTLN(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.
topiclen = buffer[3];
DEBUG_PRINT(F("Looking for subscription len ")); DEBUG_PRINTLN(topiclen);