Commit e95c87f6849be5e6ef5b47a178148671a32a08f2

Authored by Wiebe Cazemier
1 parent 6e0095bc

Check first nibble in PUBREL control packet

MQTT-3.6.1-1
Showing 1 changed file with 4 additions and 0 deletions
mqttpacket.cpp
... ... @@ -621,6 +621,10 @@ void MqttPacket::handlePubRec()
621 621 */
622 622 void MqttPacket::handlePubRel()
623 623 {
  624 + // MQTT-3.6.1-1, but why do we care, and only care for certain control packets?
  625 + if (first_byte & 0b1101)
  626 + throw ProtocolError("PUBREL first byte LSB must be 0010.");
  627 +
624 628 const uint16_t packet_id = readTwoBytesToUInt16();
625 629 sender->getSession()->removeIncomingQoS2MessageId(packet_id);
626 630  
... ...