Commit 92f401f500ec5dff191153830892c22d58c7963e

Authored by Wiebe Cazemier
1 parent 6702193e

Add small protocol requirement

Showing 1 changed file with 3 additions and 0 deletions
mqttpacket.cpp
@@ -354,6 +354,9 @@ void MqttPacket::handlePublish() @@ -354,6 +354,9 @@ void MqttPacket::handlePublish()
354 throw ProtocolError("QoS 3 is a protocol violation."); 354 throw ProtocolError("QoS 3 is a protocol violation.");
355 this->qos = qos; 355 this->qos = qos;
356 356
  357 + if (qos == 0 && dup)
  358 + throw ProtocolError("Duplicate flag is set for QoS 0 packet. This is illegal.");
  359 +
357 std::string topic(readBytes(variable_header_length), variable_header_length); 360 std::string topic(readBytes(variable_header_length), variable_header_length);
358 361
359 if (!isValidUtf8(topic)) 362 if (!isValidUtf8(topic))