Stuff used when checking the CRC needs to be done regardless of whether
authorGuy Harris <guy@alum.mit.edu>
Tue, 24 Sep 2013 19:57:41 +0000 (19:57 -0000)
committerGuy Harris <guy@alum.mit.edu>
Tue, 24 Sep 2013 19:57:41 +0000 (19:57 -0000)
we're building a protocol tree or not.

svn path=/trunk/; revision=52207

plugins/wimax/mac_hd_generic_decoder.c

index 5cf19147157ecabc0df0a5a162dfa1e904bc99b9..f054de2b3eef03cf060a31338d1513e2af184990 100644 (file)
@@ -736,19 +736,22 @@ static void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo
        col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "GMH");
 #endif
 
-       if (tree)
-       {       /* we are being asked for details */
-               /* Get the frame length */
-               tvb_len =  tvb_reported_length(tvb);
-               if (tvb_len < WIMAX_MAC_HEADER_SIZE)
-               {       /* display the error message */
+       /* Get the frame length */
+       tvb_len =  tvb_reported_length(tvb);
+       if (tvb_len < WIMAX_MAC_HEADER_SIZE)
+       {
+               if (tree) {
+                       /* display the error message */
                        generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, tvb_len, "Error: the size of Generic MAC Header tvb is too small! (%u bytes)", tvb_len);
                        /* add subtree */
                        generic_tree = proto_item_add_subtree(generic_item, ett_mac_header_generic_decoder);
                        /* display the Generic MAC Header in Hex */
                        proto_tree_add_item(generic_tree, hf_mac_header_generic_value_bytes, tvb, offset, tvb_len, ENC_NA);
-                       return;
                }
+               return;
+       }
+       if (tree)
+       {       /* we are being asked for details */
                /* get the parent */
                parent_item = proto_tree_get_parent(tree);
                /* add the MAC header info */
@@ -779,8 +782,10 @@ static void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo
                mac_ci = ((ubyte & WIMAX_MAC_HEADER_GENERIC_CI_MASK)?1:0);
                /* get the Encryption key sequence (EKS) */
                /*mac_eks = ((ubyte & WIMAX_MAC_HEADER_GENERIC_EKS_MASK)>>4); XX: not used ?? */
-               /* get the MAC length */
-               mac_len = (tvb_get_ntohs(tvb, (offset+1)) & WIMAX_MAC_HEADER_GENERIC_LEN);
+       }
+       /* get the MAC length; this is used even if tree is null */
+       mac_len = (tvb_get_ntohs(tvb, (offset+1)) & WIMAX_MAC_HEADER_GENERIC_LEN);
+       if (tree) {
                /* get the CID */
                mac_cid = tvb_get_ntohs(tvb, (offset+3));
                /* display the Header Type (HT) */