Added a try-catch in the heuristics to avoid a false malformed packet

error when having no data (occurs in COTP CR and CC).

svn path=/trunk/; revision=46038
This commit is contained in:
Stig Bjørlykke 2012-11-16 10:20:36 +00:00
parent 57d3c5e260
commit d93bf350b5
2 changed files with 24 additions and 16 deletions

View File

@ -95,14 +95,18 @@ dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree
guint32 choice_index = 100;
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
TRY {
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
/* could be BER */
get_ber_identifier(tvb, 0, &ber_class, &pc, &tag);
/* or PER */
dissect_per_constrained_integer(tvb, 0, &asn1_ctx,
NULL, hf_t125_heur, 0, 42,
&choice_index, FALSE);
/* could be BER */
get_ber_identifier(tvb, 0, &ber_class, &pc, &tag);
/* or PER */
dissect_per_constrained_integer(tvb, 0, &asn1_ctx,
NULL, hf_t125_heur, 0, 42,
&choice_index, FALSE);
} CATCH_ALL {
return FALSE;
} ENDTRY;
/* is this strong enough ? */
if ( ((ber_class==BER_CLASS_APP) && ((tag>=101) && (tag<=104))) ||

View File

@ -423,14 +423,18 @@ dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree
guint32 choice_index = 100;
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
TRY {
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
/* could be BER */
get_ber_identifier(tvb, 0, &ber_class, &pc, &tag);
/* or PER */
dissect_per_constrained_integer(tvb, 0, &asn1_ctx,
NULL, hf_t125_heur, 0, 42,
&choice_index, FALSE);
/* could be BER */
get_ber_identifier(tvb, 0, &ber_class, &pc, &tag);
/* or PER */
dissect_per_constrained_integer(tvb, 0, &asn1_ctx,
NULL, hf_t125_heur, 0, 42,
&choice_index, FALSE);
} CATCH_ALL {
return FALSE;
} ENDTRY;
/* is this strong enough ? */
if ( ((ber_class==BER_CLASS_APP) && ((tag>=101) && (tag<=104))) ||
@ -563,7 +567,7 @@ void proto_register_t125(void) {
NULL, HFILL }},
/*--- End of included file: packet-t125-hfarr.c ---*/
#line 134 "../../asn1/t125/packet-t125-template.c"
#line 138 "../../asn1/t125/packet-t125-template.c"
};
/* List of subtrees */
@ -580,7 +584,7 @@ void proto_register_t125(void) {
&ett_t125_ConnectMCSPDU,
/*--- End of included file: packet-t125-ettarr.c ---*/
#line 140 "../../asn1/t125/packet-t125-template.c"
#line 144 "../../asn1/t125/packet-t125-template.c"
};
/* Register protocol */