summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/apps/mqtt/mqtt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/apps/mqtt/mqtt.c b/src/apps/mqtt/mqtt.c
index ae3a7577..c09642be 100644
--- a/src/apps/mqtt/mqtt.c
+++ b/src/apps/mqtt/mqtt.c
@@ -711,8 +711,8 @@ mqtt_message_received(mqtt_client_t *client, u8_t fixed_hdr_len, u16_t length, u
u16_t payload_length = length;
u8_t qos = MQTT_CTL_PACKET_QOS(client->rx_buffer[0]);
- if (client->msg_idx <= MQTT_VAR_HEADER_BUFFER_LEN) {
- /* Should have topic and pkt id*/
+ if (client->msg_idx == (fixed_hdr_len + length)) {
+ /* First publish message frame. Should have topic and pkt id*/
size_t var_hdr_payload_bufsize = sizeof(client->rx_buffer) - fixed_hdr_len;
u8_t *topic;
u16_t after_topic;