Commit ae1d102fb386fef2d08fb80bd485654085537fa0
1 parent
273fc26d
Check reserved bits in AUTH packet
Showing
1 changed file
with
3 additions
and
0 deletions
mqttpacket.cpp
| ... | ... | @@ -682,6 +682,9 @@ void MqttPacket::handleConnect() |
| 682 | 682 | |
| 683 | 683 | void MqttPacket::handleExtendedAuth() |
| 684 | 684 | { |
| 685 | + if (first_byte & 0b1111) | |
| 686 | + throw ProtocolError("AUTH packet first 4 bits should be 0.", ReasonCodes::MalformedPacket); | |
| 687 | + | |
| 685 | 688 | const ReasonCodes reasonCode = static_cast<ReasonCodes>(readByte()); |
| 686 | 689 | |
| 687 | 690 | if (this->protocolVersion < ProtocolVersion::Mqtt5) | ... | ... |