mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +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)
(cherry picked from commit 6d5ddb7139
)
This commit is contained in:
parent
4deaebae44
commit
890c5982a1
@ -1292,7 +1292,7 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port,
|
||||
/* Append client id */
|
||||
mqtt_output_append_string(&client->output, client_info->client_id, client_id_length);
|
||||
/* 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_msg, will_msg_len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user