Preference to disable BER length sanity check (needed for asn2eth LDAP dissector).
svn path=/trunk/; revision=18056
This commit is contained in:
parent
d1da7d875d
commit
759203ed61
1 changed files with 13 additions and 6 deletions
|
@ -106,6 +106,7 @@ static gint ett_ber_unknown = -1;
|
||||||
static gint ett_ber_SEQUENCE = -1;
|
static gint ett_ber_SEQUENCE = -1;
|
||||||
|
|
||||||
static gboolean show_internal_ber_fields = FALSE;
|
static gboolean show_internal_ber_fields = FALSE;
|
||||||
|
static gboolean verify_ber_length_field = TRUE;
|
||||||
|
|
||||||
proto_item *ber_last_created_item=NULL;
|
proto_item *ber_last_created_item=NULL;
|
||||||
|
|
||||||
|
@ -529,6 +530,7 @@ get_ber_length(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 *length, gbo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(verify_ber_length_field){
|
||||||
/* check that the length is sane */
|
/* check that the length is sane */
|
||||||
if(tmp_length>(guint32)tvb_reported_length_remaining(tvb,offset)){
|
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));
|
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));
|
||||||
|
@ -536,6 +538,7 @@ get_ber_length(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 *length, gbo
|
||||||
tvb_ensure_bytes_exist(tvb, offset, tmp_length);
|
tvb_ensure_bytes_exist(tvb, offset, tmp_length);
|
||||||
/*tmp_length = (guint32)tvb_reported_length_remaining(tvb,offset);*/
|
/*tmp_length = (guint32)tvb_reported_length_remaining(tvb,offset);*/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (length)
|
if (length)
|
||||||
*length = tmp_length;
|
*length = tmp_length;
|
||||||
|
@ -2375,6 +2378,10 @@ proto_register_ber(void)
|
||||||
"Whether the dissector should also display internal"
|
"Whether the dissector should also display internal"
|
||||||
" ASN.1 BER details such as Identifier and Length fields", &show_internal_ber_fields);
|
" 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);
|
ber_oid_dissector_table = register_dissector_table("ber.oid", "BER OID Dissectors", FT_STRING, BASE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue