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>
This commit is contained in:
parent
061ebbda56
commit
2e13c4adb2
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue