quartiq / minimq

Minimal no_std MQTT v5.0 client implementation
MIT License
143 stars 16 forks source link

Publishing/receiving `QoS::AtLeastOnce` results in protocol errors #115

Closed ryan-summers closed 1 year ago

ryan-summers commented 1 year ago

Attempting to use AtLeastOnce publication in a round trip from minimq->minimq appears to be resulting in a protocol error during deserialization of the packet.

ryan-summers commented 1 year ago

I believe this is because of the format of the PubAck message type. The MQTT spec specifies:

3.4.2.2.1 Property Length The length of the Properties in the PUBACK packet Variable Header encoded as a Variable Byte Integer. If the Remaining Length is less than 4 there is no Property Length and the value of 0 is used.

Right now, we accept either a 2-byte packet or a 4-byte plus packet. However, viewing wireshark appears to indicate that 3-byte packets are also permissible: image

We need to fix puback deserialization to support these truncated packets as well.