From 92f401f500ec5dff191153830892c22d58c7963e Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sat, 6 Mar 2021 18:59:54 +0100 Subject: [PATCH] Add small protocol requirement --- mqttpacket.cpp | 3 +++ 1 file changed, 3 insertions(+), 0 deletions(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index ff7d681..0c65549 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -354,6 +354,9 @@ void MqttPacket::handlePublish() throw ProtocolError("QoS 3 is a protocol violation."); this->qos = qos; + if (qos == 0 && dup) + throw ProtocolError("Duplicate flag is set for QoS 0 packet. This is illegal."); + std::string topic(readBytes(variable_header_length), variable_header_length); if (!isValidUtf8(topic)) -- libgit2 0.21.4