diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-03-25 21:10:10 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-03-25 21:10:10 +0000 |
commit | 0db7a1dfef793371c53a2acd211327d333549ff1 (patch) | |
tree | f63bb4302e85e5cb46a9b1f93db70d9852113d44 /epan/dissectors/packet-mpeg-pes.c | |
parent | 612480fbe3c4097eef2c0e4a4123a1944ea47a40 (diff) |
Before accepting a packet in a heuristic dissector, don't fetch any data
without first checking to make sure it's available.
Clear the Info column as soon as we've accepted a packet.
In the "MPEG" dissector, if no subdissector accepts the packet, dissect
it as just "MPEG" data.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21187 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-mpeg-pes.c')
-rw-r--r-- | epan/dissectors/packet-mpeg-pes.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/epan/dissectors/packet-mpeg-pes.c b/epan/dissectors/packet-mpeg-pes.c index 752f7eea35..f89d697f6a 100644 --- a/epan/dissectors/packet-mpeg-pes.c +++ b/epan/dissectors/packet-mpeg-pes.c @@ -619,11 +619,16 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) asn1_ctx_t asn1_ctx; int offset = 0; + if (!tvb_bytes_exist(tvb, 0, 3)) + return FALSE; /* not enough bytes for a PES prefix */ + prefix = tvb_get_ntoh24(tvb, 0); if (prefix != PES_PREFIX) return FALSE; if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG PES"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); stream = tvb_get_guint8(tvb, 3); if (check_col(pinfo->cinfo, COL_INFO)) { @@ -755,7 +760,14 @@ static heur_dissector_list_t heur_subdissector_list; void dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree); + if (!dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree)) { + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_add_str(pinfo->cinfo, COL_PROTOCOL, "MPEG"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + if (tree) + proto_tree_add_item(tree, proto_mpeg, tvb, 0, -1, FALSE); + } } void @@ -1023,7 +1035,7 @@ proto_register_mpeg_pes(void) "mpeg_pes.BIT_STRING_SIZE_16", HFILL }}, /*--- End of included file: packet-mpeg-pes-hfarr.c ---*/ -#line 232 "packet-mpeg-pes-template.c" +#line 244 "packet-mpeg-pes-template.c" { &hf_mpeg_pes_pack_header, { "Pack header", "mpeg-pes.pack", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, @@ -1075,7 +1087,7 @@ proto_register_mpeg_pes(void) &ett_mpeg_pes_Picture, /*--- End of included file: packet-mpeg-pes-ettarr.c ---*/ -#line 272 "packet-mpeg-pes-template.c" +#line 284 "packet-mpeg-pes-template.c" }; proto_mpeg = proto_register_protocol( |