From c042ba8c6548e64dbf36c9f930f6965589b5d68b Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 8 Jul 2021 10:11:09 +0100 Subject: [PATCH] mqtt: handle NULL mqtt publish metadata --- lib/secure-streams/protocols/ss-mqtt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/secure-streams/protocols/ss-mqtt.c b/lib/secure-streams/protocols/ss-mqtt.c index a5319028a..92f8002a4 100644 --- a/lib/secure-streams/protocols/ss-mqtt.c +++ b/lib/secure-streams/protocols/ss-mqtt.c @@ -488,6 +488,10 @@ secstream_connect_munge_mqtt(lws_ss_handle_t *h, char *buf, size_t len, for (n = 0; n < (int)LWS_ARRAY_SIZE(sources); n++) { lws_strexp_init(&exp, (void *)h, lws_ss_exp_cb_metadata, (char *)p, (size_t)-1); + if (!sources[n]) { + ps[n] = NULL; + continue; + } ps[n] = (char *)p; if (lws_strexp_expand(&exp, sources[n], strlen(sources[n]), &used_in, &olen[n]) != LSTRX_DONE)