When searching for EOC (because we have an indefinite length) don't stop searching...
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 9 Jan 2008 17:06:25 +0000 (17:06 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 9 Jan 2008 17:06:25 +0000 (17:06 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24046 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-ber.c

index 79c7dd0074ee3597608a93aaece9b2b41189a984..edfc3b75936b54cd5ff4f3625e2389e4fbab7237 100644 (file)
@@ -796,8 +796,7 @@ get_ber_length(tvbuff_t *tvb, int offset, guint32 *length, gboolean *ind) {
                        /* ok in here we can traverse the BER to find the length, this will fix most indefinite length issues */
                        /* Assumption here is that indefinite length is always used on constructed types*/
                        /* check for EOC */
-                       while ((tvb_reported_length_remaining(tvb,offset)>0) && ( tvb_get_guint8(tvb, offset) || tvb_get_guint8(tvb,offset+1)))
-                               {
+                       while (tvb_get_guint8(tvb, offset) || tvb_get_guint8(tvb, offset+1)) {
                                /* not an EOC at offset */
                                s_offset=offset;
                                offset= get_ber_identifier(tvb, offset, &tclass, &tpc, &ttag);
@@ -807,7 +806,7 @@ get_ber_length(tvbuff_t *tvb, int offset, guint32 *length, gboolean *ind) {
                                 /* Make sure we've moved forward in the packet */
                                if (offset <= s_offset)
                                        THROW(ReportedBoundsError);
-                               }
+                       }
                        tmp_length += 2;
                        tmp_ind = TRUE;
                        offset = tmp_offset;
@@ -819,6 +818,10 @@ get_ber_length(tvbuff_t *tvb, int offset, guint32 *length, gboolean *ind) {
        if (ind)
                *ind = tmp_ind;
 
+#ifdef DEBUG_BER
+printf("get BER length %d, offset %d (remaining %d)\n", tmp_length, offset, tvb_length_remaining(tvb, offset));
+#endif
+
        return offset;
 }
 
@@ -845,6 +848,11 @@ dissect_ber_length(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int
                *length = tmp_length;
        if(ind)
                *ind = tmp_ind;
+
+#ifdef DEBUG_BER
+printf("dissect BER length %d, offset %d (remaining %d)\n", tmp_length, offset, tvb_length_remaining(tvb, offset));
+#endif
+
        return offset;
 }
 static int