Text   |  XML   |  ReML   |   Visible Warnings:

Cast Alters Value  at packet-rlc-lte.c:985

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

dissect_rlc_lte_am

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-rlc-lte.c)expand/collapse
Show more  
 851  static void dissect_rlc_lte_am(tvbuff_t *tvb, packet_info *pinfo,
 852                                 proto_tree *tree,
 853                                 int offset,
 854                                 rlc_lte_info *p_rlc_lte_info _U_)
 855  {
 856      guint8 is_data;
 857      guint8 is_segment;
 858      guint8 polling;
 859      guint8 fixed_extension;
 860      guint8 framing_info;
 861      gboolean first_includes_start;
 862      gboolean last_includes_end;
 863      proto_tree *am_header_tree;
 864      proto_item *am_header_ti;
 865      gint   start_offset = offset;
 866      guint16    sn;
 867   
 868      /* Add UM header subtree */
 869      am_header_ti = proto_tree_add_string_format(tree,
 870                                                  hf_rlc_lte_am_header,
 871                                                  tvb, offset, 0,
 872                                                  "",
 873                                                  "AM header");
 874      am_header_tree = proto_item_add_subtree(am_header_ti,
 875                                              ett_rlc_lte_am_header);
 876   
 877   
 878      /*******************************************/
 879      /* First bit is Data/Control flag           */
 880      is_data = (tvb_get_guint8(tvb, offset) & 0x80) >> 7;
 881      proto_tree_add_item(am_header_tree, hf_rlc_lte_am_data_control, tvb, offset, 1, FALSE);
 882      if (check_col(pinfo->cinfo, COL_INFO)) {
 883          col_append_str(pinfo->cinfo, COL_INFO, (is_data) ? " [DATA]" : " [CONTROL]");
 884      }
 885   
 886   
 887      /**************************************************/
 888      /* Control PDUs are a completely separate format  */
 889      if (!is_data) {
 890          dissect_rlc_lte_am_status_pdu(tvb, pinfo, am_header_tree, offset);
 891          return;
 892      }
 893   
 894   
 895      /******************************/
 896      /* Data PDU fixed header      */
 897   
 898      /* Re-segmentation Flag (RF) field */
 899      is_segment = (tvb_get_guint8(tvb, offset) & 0x40) >> 6;
 900      proto_tree_add_item(am_header_tree, hf_rlc_lte_am_rf, tvb, offset, 1, FALSE);
 901   
 902      /* Polling bit */
 903      polling = (tvb_get_guint8(tvb, offset) & 0x20) >> 5;
 904      proto_tree_add_item(am_header_tree, hf_rlc_lte_am_p, tvb, offset, 1, FALSE);
 905      if (check_col(pinfo->cinfo, COL_INFO)) {
 906          col_append_str(pinfo->cinfo, COL_INFO, (polling) ? " (P) " : "     ");
 907      }
 908      if (polling) {
 909          proto_item_append_text(am_header_ti, " (P)");
 910      }
 911   
 912      /* Framing Info */
 913      framing_info = (tvb_get_guint8(tvb, offset) & 0x18) >> 3;
 914      proto_tree_add_item(am_header_tree, hf_rlc_lte_am_fi, tvb, offset, 1, FALSE);
 915   
 916      /* Extension bit */
 917      fixed_extension = (tvb_get_guint8(tvb, offset) & 0x04) >> 2;
 918      proto_tree_add_item(am_header_tree, hf_rlc_lte_am_fixed_e, tvb, offset, 1, FALSE);
 919   
 920      /* Sequence Number */
 921      sn = tvb_get_ntohs(tvb, offset) & 0x03ff;
 922      proto_tree_add_item(am_header_tree, hf_rlc_lte_am_fixed_sn, tvb, offset, 2, FALSE);
 923      offset += 2;
 924   
 925[+]     if (check_col(pinfo->cinfo, COL_INFO)) {
 926          col_append_fstr(pinfo->cinfo, COL_INFO, "sn=%u", sn);
 927      }
 928   
 929   
 930      /* Show SN in AM header root */
 931      proto_item_append_text(am_header_ti, " (SN=%u)", sn);
 932      proto_item_set_len(am_header_ti, offset-start_offset);
 933   
 934      /***************************************/
 935      /* Dissect extra segment header fields */
 936      if (is_segment) {
 937          /* Last Segment Field (LSF) */
 938          proto_tree_add_item(am_header_tree, hf_rlc_lte_am_segment_lsf, tvb, offset, 1, FALSE);
 939   
 940          /* SO */
 941          proto_tree_add_item(am_header_tree, hf_rlc_lte_am_segment_so, tvb, offset, 2, FALSE);
 942   
 943          offset += 2;
 944      }
 945   
 946      /*************************************/
 947      /* AM header extension               */
 948      if (fixed_extension) {
 949          offset = dissect_rlc_lte_extension_header(tvb, pinfo, tree, offset);
 950      }
 951   
 952   
 953      /* Extract these 2 flags from framing_info */
 954      first_includes_start = (framing_info & 0x02) == 0;
 955      last_includes_end =    (framing_info & 0x01) == 0;
 956   
 957   
 958      /* Call sequence analysis function now (pretty limited for AM) */
 959  #if 0 
 960      if (global_rlc_lte_sequence_analysis) {
 961          checkChannelSequenceInfo(pinfo, tvb, p_rlc_lte_info, (guint16)sn,
 962                                   first_includes_start, last_includes_end,
 963                                   am_header_tree);
 964      }
 965  #endif
 966   
 967   
 968      /*************************************/
 969      /* Data                        */
 970      if (s_number_of_extensions > 0) {
 971          /* Show each data segment separately */
 972          int n;
 973          for (n=0; n < s_number_of_extensions; n++) {
 974              proto_tree_add_item(tree, hf_rlc_lte_am_data, tvb, offset, s_lengths[n], FALSE);
 975              show_PDU_in_info(pinfo, s_lengths[n],
 976                               (n==0) ? first_includes_start : TRUE,
 977                               TRUE);
 978              tvb_ensure_bytes_exist(tvb, offset, s_lengths[n]);
 979              offset += s_lengths[n];
 980          }
 981      }
 982   
 983      /* Final data element */
 984      proto_tree_add_item(tree, hf_rlc_lte_am_data, tvb, offset, -1, FALSE);
 985[+]     show_PDU_in_info(pinfo, (guint16)tvb_length_remaining(tvb, offset),
 986                       (s_number_of_extensions == 0) ? first_includes_start : TRUE,
 987                       last_includes_end);
Show more  




Change Warning 2917.32917 : Cast Alters Value

Priority:
State:
Finding:
Owner:
Note: