From d8d1d6409ea6ac9a64b74bdb11cab5e236bd97d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 30 Apr 2019 12:25:58 +0200 Subject: [PATCH] mqtt: Check for a valid payload protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the "Payload protocol" mandatory when configuring message decoding. Change-Id: Ia3cd8cb1b789b80439f55bdd87e7f1bd806013e0 Ping-Bug: 15738 Reviewed-on: https://code.wireshark.org/review/33021 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- epan/dissectors/packet-mqtt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c index 7ca7deb673..1a00f59bf6 100644 --- a/epan/dissectors/packet-mqtt.c +++ b/epan/dissectors/packet-mqtt.c @@ -617,6 +617,12 @@ static gboolean mqtt_message_decode_update_cb(void *record, char **error) return FALSE; } + if (u->payload_proto_name == NULL || strlen(u->payload_proto_name) == 0) + { + *error = g_strdup("Missing payload protocol"); + return FALSE; + } + if (u->match_criteria == MATCH_CRITERIA_REGEX) { u->topic_regex = g_regex_new(u->topic_pattern, (GRegexCompileFlags) G_REGEX_OPTIMIZE, (GRegexMatchFlags) 0, NULL);