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 354 throw ProtocolError("QoS 3 is a protocol violation.");
355 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 360 std::string topic(readBytes(variable_header_length), variable_header_length);
358 361  
359 362 if (!isValidUtf8(topic))
... ...