diff options
Diffstat (limited to 'epan/dissectors/packet-mms.c')
-rw-r--r-- | epan/dissectors/packet-mms.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c index c3f9c7fe6f..f703f39c8f 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -11466,9 +11466,59 @@ void proto_register_mms(void) { } +static gboolean +dissect_mms_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + /* must check that this really is an mms packet */ + int offset = 0; + guint32 length = 0 ; + guint32 oct; + gint idx = 0 ; + + gint8 tmp_class; + gboolean tmp_pc; + gint32 tmp_tag; + + /* first, check do we have at least 2 bytes (pdu) */ + if (!tvb_bytes_exist(tvb, 0, 2)) + return FALSE; /* no */ + + /* can we recognize MMS PDU ? Return FALSE if not */ + /* get MMS PDU type */ + offset = get_ber_identifier(tvb, offset, &tmp_class, &tmp_pc, &tmp_tag); + + /* check MMS type */ + + /* Class should be constructed */ + if (tmp_class!=BER_CLASS_CON) + return FALSE; + + /* see if the tag is a valid MMS PDU */ + match_strval_idx(tmp_tag, mms_MMSpdu_vals, &idx); + if (idx == -1) { + return FALSE; /* no, it isn't an MMS PDU */ + } + + /* check MMS length */ + oct = tvb_get_guint8(tvb, offset)& 0x7F; + if (oct==0) + /* MMS requires length after tag so not MMS if indefinite length*/ + return FALSE; + + offset = get_ber_length(NULL, tvb, offset, &length, NULL); + /* do we have enough bytes? */ + if (!tvb_bytes_exist(tvb, offset, length)) + return FALSE; + + dissect_mms(tvb, pinfo, parent_tree); + return TRUE; +} + /*--- proto_reg_handoff_mms --- */ void proto_reg_handoff_mms(void) { register_ber_oid_dissector("1.0.9506.2.3", dissect_mms, proto_mms,"MMS"); register_ber_oid_dissector("1.0.9506.2.1", dissect_mms, proto_mms,"mms-abstract-syntax-version1(1)"); - + heur_dissector_add("cotp", dissect_mms_heur, proto_mms); + heur_dissector_add("cotp_is", dissect_mms_heur, proto_mms); } + |