mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 21:32:46 +00:00
MQTT: Fix possible bug in connect message generation that WILL flag can be set without appending a will message
The boolean condition of setting the WILL flag differs from that of appending the will message Found by Axel Lin (I fixed it the same way as Axel suggested, but I wanted a different commit message)
This commit is contained in:
parent
a2915b7142
commit
6d5ddb7139
@ -1292,7 +1292,7 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port,
|
|||||||
/* Append client id */
|
/* Append client id */
|
||||||
mqtt_output_append_string(&client->output, client_info->client_id, client_id_length);
|
mqtt_output_append_string(&client->output, client_info->client_id, client_id_length);
|
||||||
/* Append will message if used */
|
/* Append will message if used */
|
||||||
if (will_topic_len > 0) {
|
if ((flags & MQTT_CONNECT_FLAG_WILL) != 0) {
|
||||||
mqtt_output_append_string(&client->output, client_info->will_topic, will_topic_len);
|
mqtt_output_append_string(&client->output, client_info->will_topic, will_topic_len);
|
||||||
mqtt_output_append_string(&client->output, client_info->will_msg, will_msg_len);
|
mqtt_output_append_string(&client->output, client_info->will_msg, will_msg_len);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user