From e95c87f6849be5e6ef5b47a178148671a32a08f2 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sat, 9 Oct 2021 13:03:04 +0200 Subject: [PATCH] Check first nibble in PUBREL control packet --- mqttpacket.cpp | 4 ++++ 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index f729db4..055b1cd 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -621,6 +621,10 @@ void MqttPacket::handlePubRec() */ void MqttPacket::handlePubRel() { + // MQTT-3.6.1-1, but why do we care, and only care for certain control packets? + if (first_byte & 0b1101) + throw ProtocolError("PUBREL first byte LSB must be 0010."); + const uint16_t packet_id = readTwoBytesToUInt16(); sender->getSession()->removeIncomingQoS2MessageId(packet_id); -- libgit2 0.21.4