From 01e089fd07f766aec13705b7a1c3d2805f1f9d5e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 24 Jul 2024 08:23:04 -0500 Subject: [PATCH] Ignore invalid service envelopes (#4326) --- src/mqtt/MQTT.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 5f7d6d9027..a7085dffe3 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -135,6 +135,10 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length) LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length); return; } else { + if (e.channel_id == NULL || e.gateway_id == NULL) { + LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length); + return; + } meshtastic_Channel ch = channels.getByName(e.channel_id); if (strcmp(e.gateway_id, owner.id) == 0) { // Generate an implicit ACK towards ourselves (handled and processed only locally!) for this message.