Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Control Flow  at wimax_utils.c:3577

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

wimax_common_tlv_encoding_decoder

(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_utils.c)expand/collapse
Show more  
 3471  guint wimax_common_tlv_encoding_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 3472  {
 3473          guint offset, value;
 3474          guint tvb_len, tlv_len, tlv_value_offset;
 3475          gint  tlv_type;
 3476          proto_tree *tlv_tree = NULL;
 3477          tlv_info_t tlv_info;
 3478          gfloat current_power;
 3479   
 3480          /* get the tvb reported length */
 3481          tvb_len = tvb_reported_length(tvb);
 3482          /* do nothing if the TLV fields is not exist */
 3483          if(!tvb_len)
 3484                  return 0;
 3485          /* report error if the packet size is less than 2 bytes (type+length) */
 3486          if(tvb_len < 2)
 3487          {       /* invalid tlv info */
 3488                  if(check_col(pinfo->cinfo, COL_INFO))
 3489                  {
 3490                          col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Common TLV encoding");
 3491                  }
 3492                  proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, 0, tvb_len, FALSE);
 3493                  return 0;
 3494          }
 3495          /* process Common TLV Encoding (11.1) */
 3496          for(offset = 0; offset < tvb_len; )
 3497          {
 3498                  /* get the TLV information */
 3499                  init_tlv_info(&tlv_info, tvb, offset);
 3500                  /* get the TLV type */
 3501                  tlv_type = get_tlv_type(&tlv_info);
 3502                  /* get the TLV length */
 3503                  tlv_len = get_tlv_length(&tlv_info);
 3504                  if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
 3505                  {       /* invalid tlv info */
 3506                          if(check_col(pinfo->cinfo, COL_INFO))
 3507                          {
 3508                                  col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Common TLV encoding TLV error");
 3509                          }
 3510                          proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE);
 3511                          break;
 3512                  }
 3513                  /* get the TLV value offset */
 3514                  tlv_value_offset = get_tlv_value_offset(&tlv_info);
 3515  #ifdef DEBUG /* for debug only */
 3516                  proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, (tlv_len + tlv_value_offset), "Common TLV Encoding TLV Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tvb_len);
 3517  #endif
 3518                  /* update the offset for the TLV value */
 3519                  offset += tlv_value_offset;
 3520                  /* parse Common TLV Encoding (table 346) */
 3521                  switch (tlv_type)
 3522                  {
 3523                          case VENDOR_SPECIFIC_INFO:
 3524                                  /* display Vendor-Specific Information */
 3525                                  /* add subtree */
 3526                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Vendor-Specific Information (%u bytes)", tlv_len);
 3527                                  /* decode and display the Vendor-Specific Information */
 3528                                  wimax_vendor_specific_information_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree);
 3529                          break;
 3530                          case VENDOR_ID_ENCODING:
 3531                                  /* display Vendor ID Encoding */
 3532                                  /* add subtree */
 3533                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Vendor ID Encoding (%u bytes)", tlv_len);
 3534                                  /* decode and display the Vendor ID Encoding */
 3535                                  proto_tree_add_item(tlv_tree, hf_common_tlv_vendor_id, tvb, offset, tlv_len, FALSE);
 3536                          break;
 3537                          case DSx_UPLINK_FLOW:
 3538                                  /* display Uplink Service Flow Encodings info */
 3539                                  /* add subtree */
 3540                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_ul_service_flow_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Uplink Service Flow Encodings (%u bytes)", tlv_len);
 3541                                  /* decode and display the UL Service Flow Encodings */
 3542                                  wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree);
 3543                          break;
 3544                          case DSx_DOWNLINK_FLOW:
 3545                                  /* display Downlink Service Flow Encodings info */
 3546                                  /* add subtree */
 3547                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_dl_service_flow_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Downlink Service Flow Encodings (%u bytes)", tlv_len);
 3548                                  /* decode and display the DL Service Flow Encodings */
 3549                                  wimax_service_flow_encodings_decoder(tvb_new_subset(tvb,offset, tlv_len, tlv_len), pinfo, tlv_tree);
 3550                          break;
 3551                          case CURRENT_TX_POWER:
 3552                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_dl_service_flow_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "Current Transmitted Power (%u byte(s))", tlv_len);
 3553                                  value = tvb_get_guint8(tvb, offset);
 3554                                  current_power = (gfloat)(value - 128) / 2;
 3555                                  proto_tree_add_text(tlv_tree, tvb, offset, 1, "Current Transmitted Power: %.2f dBm (Value: 0x%x)", (gdouble)current_power, value);
 3556                          break;
 3557                          case MAC_VERSION_ENCODING:
 3558                                  /* display MAC Version Encoding */
 3559                                  /* add subtree */
 3560                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "MAC Version Encoding (%u byte)", tlv_len);
 3561                                  /* decode and display the MAC Version Encoding */
 3562                                  proto_tree_add_item(tlv_tree, hf_common_tlv_mac_version, tvb, offset, tlv_len, FALSE);
 3563                          break;
 3564                          case HMAC_TUPLE:        /* Table 348d */
 3565                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len);
 3566                                  /* decode and display the HMAC Tuple */
 3567                                  wimax_hmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len);
 3568                          break;
 3569                          case CMAC_TUPLE:        /* Table 348b */
 3570                                  tlv_tree = add_protocol_subtree(&tlv_info, ett_vendor_specific_info_decoder, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len);
 3571                                  /* decode and display the CMAC Tuple */
 3572                                  wimax_cmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len);
 3573                          break;
 3574                          default:
 3575                                  /* Back to calling routine to finish decoding. */
 3576                                  return offset - tlv_value_offset;  /* Ret amount decoded. */
 3577                          break;
 3578                  }
 3579                  offset += tlv_len;
 3580          }       /* end of while loop */
 3581          return offset;
 3582  }
Show more  




Change Warning 3905.34783 : Unreachable Control Flow

Priority:
State:
Finding:
Owner:
Note: