aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGraeme Lunt <graeme.lunt@smhs.co.uk>2006-05-01 09:26:40 +0000
committerGraeme Lunt <graeme.lunt@smhs.co.uk>2006-05-01 09:26:40 +0000
commit759203ed619c4131d4c4b7931779a9fe1078c95c (patch)
tree8e59e721d7300c3b9eb020ff662ac971fa556149 /epan
parentd1da7d875d6a6ec5b993629e432ef41dd68161a3 (diff)
Preference to disable BER length sanity check (needed for asn2eth LDAP dissector).
svn path=/trunk/; revision=18056
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-ber.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index b41e6e1297..3155ed89cb 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -106,6 +106,7 @@ static gint ett_ber_unknown = -1;
static gint ett_ber_SEQUENCE = -1;
static gboolean show_internal_ber_fields = FALSE;
+static gboolean verify_ber_length_field = TRUE;
proto_item *ber_last_created_item=NULL;
@@ -529,12 +530,14 @@ get_ber_length(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 *length, gbo
}
}
- /* check that the length is sane */
- if(tmp_length>(guint32)tvb_reported_length_remaining(tvb,offset)){
- proto_tree_add_text(tree, tvb, old_offset, offset-old_offset, "BER: Error length:%u longer than tvb_reported_length_remaining:%d",tmp_length, tvb_reported_length_remaining(tvb, offset));
- /* force the appropriate exception */
- tvb_ensure_bytes_exist(tvb, offset, tmp_length);
- /*tmp_length = (guint32)tvb_reported_length_remaining(tvb,offset);*/
+ if(verify_ber_length_field){
+ /* check that the length is sane */
+ if(tmp_length>(guint32)tvb_reported_length_remaining(tvb,offset)){
+ proto_tree_add_text(tree, tvb, old_offset, offset-old_offset, "BER: Error length:%u longer than tvb_reported_length_remaining:%d",tmp_length, tvb_reported_length_remaining(tvb, offset));
+ /* force the appropriate exception */
+ tvb_ensure_bytes_exist(tvb, offset, tmp_length);
+ /*tmp_length = (guint32)tvb_reported_length_remaining(tvb,offset);*/
+ }
}
if (length)
@@ -2375,6 +2378,10 @@ proto_register_ber(void)
"Whether the dissector should also display internal"
" ASN.1 BER details such as Identifier and Length fields", &show_internal_ber_fields);
+ prefs_register_bool_preference(ber_module, "verify_length",
+ "Verify length",
+ "Verify that the current packet contains (at least) the number of bytes indicated by the length field", &verify_ber_length_field);
+
ber_oid_dissector_table = register_dissector_table("ber.oid", "BER OID Dissectors", FT_STRING, BASE_NONE);
}