diff options
Diffstat (limited to 'epan/dissectors/packet-xml.c')
-rw-r--r-- | epan/dissectors/packet-xml.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index 9daef272d2..c26b241f23 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -217,7 +217,7 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) current_frame->ns = root_ns; - current_frame->item = proto_tree_add_item(tree,current_frame->ns->hf_tag,tvb,0,-1,FALSE); + current_frame->item = proto_tree_add_item(tree,current_frame->ns->hf_tag,tvb,0,-1,ENC_UTF_8|ENC_NA); current_frame->tree = proto_item_add_subtree(current_frame->item,current_frame->ns->ett); current_frame->last_item = current_frame->item; @@ -227,18 +227,16 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } static gboolean dissect_xml_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (pref_heuristic_media || pref_heuristic_tcp || pref_heuristic_udp) { - if (tvbparse_peek(tvbparse_init(tvb,0,-1,NULL,want_ignore), want_heur)) { - dissect_xml(tvb, pinfo, tree); + if (tvbparse_peek(tvbparse_init(tvb,0,-1,NULL,want_ignore), want_heur)) { + dissect_xml(tvb, pinfo, tree); + return TRUE; + } else if (pref_heuristic_unicode) { + const guint8 *data = tvb_get_ephemeral_unicode_string(tvb, 0, tvb_length(tvb), ENC_LITTLE_ENDIAN); + tvbuff_t *unicode_tvb = tvb_new_child_real_data(tvb, data, tvb_length(tvb)/2, tvb_length(tvb)/2); + if (tvbparse_peek(tvbparse_init(unicode_tvb,0,-1,NULL,want_ignore), want_heur)) { + add_new_data_source(pinfo, unicode_tvb, "UTF8"); + dissect_xml(unicode_tvb, pinfo, tree); return TRUE; - } else if (pref_heuristic_unicode) { - const guint8 *data = tvb_get_ephemeral_unicode_string(tvb, 0, tvb_length(tvb)/2, ENC_LITTLE_ENDIAN); - tvbuff_t *unicode_tvb = tvb_new_child_real_data(tvb, data, tvb_length(tvb)/2, tvb_length(tvb)/2); - if (tvbparse_peek(tvbparse_init(unicode_tvb,0,-1,NULL,want_ignore), want_heur)) { - add_new_data_source(pinfo, unicode_tvb, "UTF8"); - dissect_xml(unicode_tvb, pinfo, tree); - return TRUE; - } } } return FALSE; @@ -312,7 +310,7 @@ static void after_token(void* tvbparse_data, const void* wanted_data _U_, tvbpar hfid = xml_ns.hf_cdata; } - pi = proto_tree_add_item(current_frame->tree, hfid, tok->tvb, tok->offset, tok->len, FALSE); + pi = proto_tree_add_item(current_frame->tree, hfid, tok->tvb, tok->offset, tok->len, ENC_UTF_8|ENC_NA); proto_item_set_text(pi, "%s", tvb_format_text(tok->tvb,tok->offset,tok->len)); @@ -354,7 +352,7 @@ static void before_xmpli(void* tvbparse_data, const void* wanted_data _U_, tvbpa ett = ns->ett; } - pi = proto_tree_add_item(current_frame->tree,hf_tag,tok->tvb,tok->offset,tok->len,FALSE); + pi = proto_tree_add_item(current_frame->tree,hf_tag,tok->tvb,tok->offset,tok->len,ENC_UTF_8|ENC_NA); proto_item_set_text(pi, "%s", tvb_format_text(tok->tvb,tok->offset,(name_tok->offset - tok->offset) + name_tok->len)); @@ -440,7 +438,7 @@ static void before_tag(void* tvbparse_data, const void* wanted_data _U_, tvbpars } } - pi = proto_tree_add_item(current_frame->tree,ns->hf_tag,tok->tvb,tok->offset,tok->len,FALSE); + pi = proto_tree_add_item(current_frame->tree,ns->hf_tag,tok->tvb,tok->offset,tok->len,ENC_UTF_8|ENC_NA); proto_item_set_text(pi, "%s", tvb_format_text(tok->tvb,tok->offset,(name_tok->offset - tok->offset) + name_tok->len)); pt = proto_item_add_subtree(pi,ns->ett); @@ -575,7 +573,7 @@ static void after_attrib(void* tvbparse_data, const void* wanted_data _U_, tvbpa value = tok; } - pi = proto_tree_add_item(current_frame->tree,hfid,value->tvb,value->offset,value->len,FALSE); + pi = proto_tree_add_item(current_frame->tree,hfid,value->tvb,value->offset,value->len,ENC_UTF_8|ENC_NA); proto_item_set_text(pi, "%s", tvb_format_text(tok->tvb,tok->offset,tok->len)); current_frame->last_item = pi; @@ -1417,5 +1415,6 @@ proto_reg_handoff_xml(void) xml_handle = find_dissector("xml"); g_hash_table_foreach(media_types,add_dissector_media,NULL); + heur_dissector_add("wtap_file", dissect_xml_heur, xml_ns.hf_tag); } |