Merge pull request #1922 from meshtastic/develop

fix #1916
This commit is contained in:
Thomas Göttgens 2022-11-08 23:15:04 +01:00 committed by GitHub
commit ad05b91f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,10 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
DEBUG_MSG("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length);
}
} else {
pb_decode_from_bytes(payload, length, ServiceEnvelope_fields, &e);
if (!pb_decode_from_bytes(payload, length, ServiceEnvelope_fields, &e)) {
DEBUG_MSG("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length);
return;
}else {
if (strcmp(e.gateway_id, owner.id) == 0)
DEBUG_MSG("Ignoring downlink message we originally sent.\n");
else {
@ -84,7 +87,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
packetPool.release(p);
}
}
}
// make sure to free both strings and the MeshPacket (passing in NULL is acceptable)
free(e.channel_id);
free(e.gateway_id);