diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-02-08 18:08:20 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-02-08 18:19:16 +0000 |
commit | 2e13c4adb29bbd8a9cf01e4ceda93d65dd377c14 (patch) | |
tree | c3e418055eb3e0e5ff8fed3a7d28310853992fdc /epan | |
parent | 061ebbda564d719df69da24663c60a78584b5b9b (diff) |
mqtt: document UTF-8 requirement for topic_str
If someone changes this in the future and the data is no longer valid
UTF-8, then crashes can occur.
Change-Id: I2b153d48ee1ef7093a5141001a391dd440c30e58
Ping-Bug: 14905
Reviewed-on: https://code.wireshark.org/review/31942
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-mqtt.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c index ec1bda793a..ad27d939da 100644 --- a/epan/dissectors/packet-mqtt.c +++ b/epan/dissectors/packet-mqtt.c @@ -685,6 +685,7 @@ static void mqtt_user_decode_message(proto_tree *tree, proto_tree *mqtt_tree, pa if (message_decode_entry->topic_regex) { GMatchInfo *match_info = NULL; + /* DISSECTOR_ASSERT(g_utf8_validate(topic_str, -1, NULL)); */ g_regex_match(message_decode_entry->topic_regex, topic_str, (GRegexMatchFlags) 0, &match_info); match_found = g_match_info_matches(match_info); g_match_info_free(match_info); @@ -1078,6 +1079,7 @@ static int dissect_mqtt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi proto_tree_add_item_ret_uint(mqtt_tree, hf_mqtt_topic_len, tvb, offset, 2, ENC_BIG_ENDIAN, &mqtt_str_len); offset += 2; + /* 'topic_regex' requires topic_str to be valid UTF-8. */ proto_tree_add_item_ret_string(mqtt_tree, hf_mqtt_topic, tvb, offset, mqtt_str_len, ENC_UTF_8|ENC_NA, wmem_epan_scope(), &topic_str); offset += mqtt_str_len; |