Skip to content
Snippets Groups Projects
Commit bcebd3af authored by Simon Duquennoy's avatar Simon Duquennoy
Browse files

MQTT parse_publish_vhdr: added missing check of topic length

parent 3b5369cf
No related branches found
No related tags found
No related merge requests found
......@@ -881,7 +881,11 @@ parse_publish_vhdr(struct mqtt_connection *conn,
conn->in_packet.topic_len |= input_data_ptr[(*pos)++];
conn->in_packet.byte_counter++;
conn->in_packet.topic_len_received = 1;
/* Abort if topic is longer than our topic buffer */
if(conn->in_packet.topic_len > MQTT_MAX_TOPIC_LENGTH) {
DBG("MQTT - topic too long %u/%u\n", conn->in_packet.topic_len, MQTT_MAX_TOPIC_LENGTH);
return;
}
DBG("MQTT - Read PUBLISH topic len %i\n", conn->in_packet.topic_len);
/* WARNING: Check here if TOPIC fits in payload area, otherwise error */
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment