This is a rather special case, but I believe it is allowed in the MQTT standards.
During our testing of the Wolf Library, we published to a topic which did not have any subscribers (that is, the subscribers had not yet been set up).
The Broker responded with a shorten PUBREC packet, with "reason code" (16) of "No matching Subscribers".
However, the Library did not support the shortened packet, discarded reason code, and returned "result code" (-2) of MQTT_CODE_ERROR_OUT_OF_BUFFER.
The library actually tried to process "props" that were not in the shortened packet.
The MQTT-v5.0 standard mentions (in section 188.8.131.52.1) that "If the Remaining Length is less than 4 there is no Property Length and the value of 0 is used."
The reason code is discarded as the Library uses a NULL packet object for this part of the processing during MQTT_MSG_WAIT.
For reference, see line 820 of mqtt_client.c, where
rc = MqttClient_DecodePacket(client, client->rx_buf,
client->packet.buf_len, NULL, &packet_type, NULL, &packet_id);
Consequently, the broker's valid response is rejected, without telling the application the "reason code".
Can you please advise how to handle this situation.
Details for recreating issue:
Broker was "broker.hivemq.com"
Publish to any non-subscribed topic.
PUBREC data received was 50 03 00 01 10,
where 50=PUBREC, 03=Remaining Length, 0001=packet ID, 10=reason code