diff --git a/mqttpacket.cpp b/mqttpacket.cpp index 0c78aac..73a602e 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -682,6 +682,9 @@ void MqttPacket::handleConnect() void MqttPacket::handleExtendedAuth() { + if (first_byte & 0b1111) + throw ProtocolError("AUTH packet first 4 bits should be 0.", ReasonCodes::MalformedPacket); + const ReasonCodes reasonCode = static_cast(readByte()); if (this->protocolVersion < ProtocolVersion::Mqtt5)