aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/ranap
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/asn1/ranap')
-rw-r--r--epan/dissectors/asn1/ranap/packet-ranap-template.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/epan/dissectors/asn1/ranap/packet-ranap-template.c b/epan/dissectors/asn1/ranap/packet-ranap-template.c
index 6dcc0b92de..ef7c2d7de0 100644
--- a/epan/dissectors/asn1/ranap/packet-ranap-template.c
+++ b/epan/dissectors/asn1/ranap/packet-ranap-template.c
@@ -267,12 +267,9 @@ dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
{
guint8 temp;
guint16 word;
- asn1_ctx_t asn1_ctx;
guint length;
int offset;
- asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
-
/* Is it a ranap packet?
*
* 4th octet should be the length of the rest of the message.
@@ -285,9 +282,21 @@ dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
#define LENGTH_OFFSET 3
#define MSG_TYPE_OFFSET 1
if (tvb_captured_length(tvb) < RANAP_MSG_MIN_LENGTH) { return FALSE; }
- /* Read the length NOTE offset in bits */
- offset = dissect_per_length_determinant(tvb, LENGTH_OFFSET<<3, &asn1_ctx, tree, -1, &length, NULL);
- offset = offset>>3;
+ /* compute aligned PER length determinant without calling dissect_per_length_determinant()
+ to avoid exceptions and info added to tree, info column and expert info */
+ offset = LENGTH_OFFSET;
+ length = tvb_get_guint8(tvb, offset);
+ offset += 1;
+ if ((length & 0x80) == 0x80) {
+ if ((length & 0xc0) == 0x80) {
+ length &= 0x3f;
+ length <<= 8;
+ length += tvb_get_guint8(tvb, offset);
+ offset += 1;
+ } else {
+ length = 0;
+ }
+ }
if (length!= (tvb_reported_length(tvb) - offset)){
return FALSE;
}