From 4528043ab6e77197b3f64350838e6244db32a7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Thu, 16 Oct 2008 10:50:12 +0000 Subject: [PATCH] Fixed decoding of multiple sequences in a sequence of implict sequence. Removed attempt to fix number of items in indef sequence-of and set-of. svn path=/trunk/; revision=26476 --- epan/dissectors/packet-ber.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index ade78fd215..d522dca127 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -3208,6 +3208,8 @@ static int dissect_ber_sq_of(gboolean implicit_tag, gint32 type, asn1_ctx_t *act proto_item *causex; int cnt, hoffsetx, end_offset; header_field_info *hfi; + gint length_remaining; + tvbuff_t *next_tvb; #ifdef DEBUG_BER_SQ_OF { @@ -3273,9 +3275,6 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name); */ /* XXX Do we really need to count them at all ? ronnie */ if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){ - if (ind) { - cnt--; /* don't count EOC as an item */ - } while (offset < end_offset){ guint32 len; gint s_offset; @@ -3383,11 +3382,16 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n",name); /* Function has IMPLICIT TAG */ } + length_remaining=tvb_length_remaining(tvb, hoffset); + if (length_remaining>eoffset-hoffset) + length_remaining=eoffset-hoffset; + next_tvb = tvb_new_subset(tvb, hoffset, length_remaining, eoffset-hoffset); + imp_tag = FALSE; if(seq->flags == BER_FLAGS_IMPLTAG) imp_tag = TRUE; /* call the dissector for this field */ - count=seq->func(imp_tag, tvb, hoffset, actx, tree, *seq->p_id)-hoffset; + count=seq->func(imp_tag, next_tvb, 0, actx, tree, *seq->p_id)-hoffset; /* hold on if we are implicit and the result is zero, i.e. the item in the sequence of doesnt match the next item, thus this implicit sequence is over, return the number of bytes we have eaten to allow the possible upper sequence continue... */ @@ -3418,6 +3422,8 @@ static int dissect_ber_old_sq_of(gboolean implicit_tag, gint32 type, asn1_ctx_t proto_item *causex; int cnt, hoffsetx, end_offset; header_field_info *hfi; + gint length_remaining; + tvbuff_t *next_tvb; #ifdef DEBUG_BER_SQ_OF { @@ -3483,9 +3489,6 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n",name); */ /* XXX Do we really need to count them at all ? ronnie */ if(tvb_length_remaining(tvb, offset)==tvb_reported_length_remaining(tvb, offset)){ - if (ind) { - cnt--; /* don't count EOC as an item */ - } while (offset < end_offset){ guint32 len; gint s_offset; @@ -3591,6 +3594,12 @@ printf("SQ OF dissect_ber_old_sq_of(%s) entered\n",name); hoffset = dissect_ber_length(actx->pinfo, tree, tvb, hoffset, NULL, NULL); } + length_remaining=tvb_length_remaining(tvb, hoffset); + if (length_remaining>eoffset-hoffset) + length_remaining=eoffset-hoffset; + next_tvb = tvb_new_subset(tvb, hoffset, length_remaining, eoffset-hoffset); + + /* call the dissector for this field */ count=seq->func(tree, tvb, hoffset, actx)-hoffset; /* hold on if we are implicit and the result is zero, i.e. the item in the sequence of