1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

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.
This commit is contained in:
Gary Christiansen 2021-04-02 09:39:28 -06:00 committed by Andy Green
parent 69f2ad9ced
commit 12f20503b4

View file

@ -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);