From 12f20503b4479baf4631c7089dce55f878eb654c Mon Sep 17 00:00:00 2001 From: Gary Christiansen Date: Fri, 2 Apr 2021 09:39:28 -0600 Subject: [PATCH] mqtt: Fixes setting the length of the last will message It was previously using the length of the topic for the message. It would break if the topic and message were not the same length. --- lib/roles/mqtt/client/client-mqtt-handshake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roles/mqtt/client/client-mqtt-handshake.c b/lib/roles/mqtt/client/client-mqtt-handshake.c index d395ea045..ab9cec79e 100644 --- a/lib/roles/mqtt/client/client-mqtt-handshake.c +++ b/lib/roles/mqtt/client/client-mqtt-handshake.c @@ -111,7 +111,7 @@ lws_mqtt_client_send_connect(struct lws *wsi) memcpy(p, c->will.topic->buf, c->will.topic->len); p += c->will.topic->len; if (lws_mqtt_str_is_not_empty(c->will.message)) { - lws_ser_wu16be(p, c->will.topic->len); + lws_ser_wu16be(p, c->will.message->len); p += 2; memcpy(p, c->will.message->buf, c->will.message->len);