@@ -2741,19 +2741,24 @@ int MqttDecode_Auth(byte *rx_buf, int rx_buf_len, MqttAuth *auth)
27412741 if (tmp < 0 )
27422742 return tmp ;
27432743 rx_payload += tmp ;
2744- }
2745- else if (auth -> reason_code != MQTT_REASON_SUCCESS ) {
2746- /* The Reason Code and Property Length can be omitted if the
2747- Reason Code is 0x00 (Success) and there are no Properties.
2748- In this case the AUTH has a Remaining Length of 0. */
2749- return MQTT_TRACE_ERROR (MQTT_CODE_ERROR_MALFORMED_DATA );
2750- }
2751- if (auth -> props != NULL ) {
2752- /* Must have Authentication Method */
2744+ }
2745+ else if (auth -> reason_code != MQTT_REASON_SUCCESS ) {
2746+ /* The Reason Code and Property Length can be omitted if
2747+ the Reason Code is 0x00 (Success) and there are no
2748+ Properties. In this case the AUTH has a Remaining
2749+ Length of 0. */
2750+ return MQTT_TRACE_ERROR (MQTT_CODE_ERROR_MALFORMED_DATA );
2751+ }
2752+ if (auth -> props != NULL ) {
2753+ /* Must have Authentication Method */
27532754
2754- /* Must have Authentication Data */
2755+ /* Must have Authentication Data */
27552756
2756- /* May have zero or more User Property pairs */
2757+ /* May have zero or more User Property pairs */
2758+ }
2759+ else {
2760+ return MQTT_TRACE_ERROR (MQTT_CODE_ERROR_MALFORMED_DATA );
2761+ }
27572762 }
27582763 else {
27592764 return MQTT_TRACE_ERROR (MQTT_CODE_ERROR_MALFORMED_DATA );
@@ -2762,10 +2767,6 @@ int MqttDecode_Auth(byte *rx_buf, int rx_buf_len, MqttAuth *auth)
27622767 else {
27632768 return MQTT_TRACE_ERROR (MQTT_CODE_ERROR_MALFORMED_DATA );
27642769 }
2765- }
2766- else {
2767- return MQTT_TRACE_ERROR (MQTT_CODE_ERROR_MALFORMED_DATA );
2768- }
27692770 }
27702771 else {
27712772 /* Per MQTT 5.0 section 3.15.2: Remaining Length of 0 implies
0 commit comments