Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at packet-ieee80211.c:6960

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

dissect_ieee80211_common

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ieee80211.c)expand/collapse
Show more  
 6069  dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
 6070          proto_tree * tree, gboolean fixed_length_header, gint fcs_len,
 6071          gboolean wlan_broken_fc, gboolean datapad,
 6072          gboolean is_ht)
 6073  {
 6074    guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
 6075    guint16 seq_control;
 6076    guint32 seq_number, frag_number;
 6077    gboolean more_frags;
 6078    const guint8 *src = NULL;
 6079    const guint8 *dst = NULL;
 6080    const guint8 *bssid = NULL;
 6081    proto_item *ti = NULL;
 6082    proto_item *fcs_item = NULL;
 6083    proto_item *cw_item = NULL;
 6084    proto_item *hidden_item;
 6085    proto_tree *volatile hdr_tree = NULL;
 6086    proto_tree *fcs_tree = NULL;
 6087    proto_tree *cw_tree = NULL;
 6088    guint16 hdr_len, ohdr_len, htc_len = 0;
 6089    gboolean has_fcs, fcs_good, fcs_bad;
 6090    gint len, reported_len, ivlen;
 6091    gboolean is_amsdu = 0;
 6092    gboolean save_fragmented;
 6093    tvbuff_t *volatile next_tvb = NULL;
 6094    guint32 addr_type;
 6095    volatile encap_t encap_type;
 6096    guint8 octet1, octet2;
 6097    char out_buff[SHORT_STR];
 6098    gint is_iv_bad;
 6099    guchar iv_buff[4];
 6100    const char *addr1_str = NULL;
 6101    int addr1_hf = -1;
 6102    guint offset;
 6103    const gchar *fts_str;
 6104    gchar flag_str[] = "opmPRMFTC";
 6105    gint i;
 6106   
 6107    wlan_hdr *volatile whdr;
 6108    static wlan_hdr whdrs[4];
 6109    gboolean retransmitted;
 6110   
 6111    whdr= &whdrs[0];
 6112   
 6113    if (check_col (pinfo->cinfo, COL_PROTOCOL))
 6114      col_set_str (pinfo->cinfo, COL_PROTOCOL, "IEEE 802.11");
 6115[+]   if (check_col (pinfo->cinfo, COL_INFO))
 6116      col_clear (pinfo->cinfo, COL_INFO);
 6117   
 6118    fcf = FETCH_FCF(0);
 6119    frame_type_subtype = COMPOSE_FRAME_TYPE(fcf);
 6120    if (frame_type_subtype == CTRL_CONTROL_WRAPPER)
 6121      ctrl_fcf = FETCH_FCF(10);
 6122    else 
 6123      ctrl_fcf = 0;
 6124   
 6125    if (fixed_length_header)
 6126      hdr_len = DATA_LONG_HDR_LEN;
 6127    else 
 6128      hdr_len = find_header_length (fcf, ctrl_fcf, is_ht);
 6129    ohdr_len = hdr_len;
 6130    if (datapad)
 6131      hdr_len = roundup2(hdr_len, 4);
 6132   
 6133    fts_str = val_to_str(frame_type_subtype, frame_type_subtype_vals,
 6134                "Unrecognized (Reserved frame)");
 6135    if (check_col (pinfo->cinfo, COL_INFO))
 6136        col_set_str (pinfo->cinfo, COL_INFO, fts_str);
 6137   
 6138   
 6139    flags = FCF_FLAGS (fcf);
 6140    more_frags = HAVE_FRAGMENTS (flags);
 6141   
 6142    for (i = 0; i < 8; i++) {
 6143      if (! (flags & 0x80 >> i)) {
 6144        flag_str[i] = '.';
 6145      }
 6146    }
 6147   
 6148    if (is_ht && IS_STRICTLY_ORDERED(flags) &&
 6149      ((FCF_FRAME_TYPE(fcf) == MGT_FRAME) || (FCF_FRAME_TYPE(fcf) == DATA_FRAME &&
 6150        DATA_FRAME_IS_QOS(frame_type_subtype)))) {
 6151      htc_len = 4;
 6152    }
 6153   
 6154    /* Add the FC to the current tree */
 6155    if (tree)
 6156      {
 6157        ti = proto_tree_add_protocol_format (tree, proto_wlan, tvb, 0, hdr_len,
 6158            "IEEE 802.11 %s", fts_str);
 6159        hdr_tree = proto_item_add_subtree (ti, ett_80211);
 6160   
 6161        dissect_frame_control(hdr_tree, tvb, wlan_broken_fc, 0);
 6162   
 6163        if (frame_type_subtype == CTRL_PS_POLL)
 6164          proto_tree_add_uint(hdr_tree, hf_assoc_id,tvb,2,2,
 6165              ASSOC_ID(tvb_get_letohs(tvb,2)));
 6166   
 6167        else 
 6168          proto_tree_add_uint (hdr_tree, hf_did_duration, tvb, 2, 2,
 6169              tvb_get_letohs (tvb, 2));
 6170      }
 6171   
 6172    /*
 6173     * Decode the part of the frame header that isn't the same for all
 6174     * frame types.
 6175     */
 6176    seq_control = 0;
 6177    frag_number = 0;
 6178    seq_number = 0;
 6179   
 6180    switch (FCF_FRAME_TYPE (fcf))
 6181    {
 6182   
 6183      case MGT_FRAME:
 6184        /*
 6185         * All management frame types have the same header.
 6186         */
 6187        src = tvb_get_ptr (tvb, 10, 6);
 6188        dst = tvb_get_ptr (tvb, 4, 6);
 6189   
 6190        SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
 6191
6638
Show [ Lines 6191 to 6638 omitted. ]
 6639              PROTO_ITEM_SET_HIDDEN(hidden_item);
 6640              hidden_item = proto_tree_add_ether (hdr_tree, hf_addr, tvb, 24, 6, src);
 6641              PROTO_ITEM_SET_HIDDEN(hidden_item);
 6642              break;
 6643          }
 6644   
 6645        }
 6646        break;
 6647    }
 6648   
 6649    len = tvb_length_remaining(tvb, hdr_len);
 6650    reported_len = tvb_reported_length_remaining(tvb, hdr_len);
 6651   
 6652    switch (fcs_len)
 6653      {
 6654        case 0: /* Definitely has no FCS */
 6655          has_fcs = FALSE;
 6656          break;
 6657   
 6658        case 4: /* Definitely has an FCS */
 6659          has_fcs = TRUE;
 6660          break;
 6661   
 6662        default: /* Don't know - use "wlan_check_fcs" */
 6663          has_fcs = wlan_check_fcs;
 6664          break;
 6665      }
 6666    if (has_fcs)
 6667      {
 6668        /*
 6669         * Well, this packet should, in theory, have an FCS.
 6670         * Do we have the entire packet, and does it have enough data for 
 6671         * the FCS?
 6672         */
 6673        if (reported_len < 4)
 6674        {
 6675          /*
 6676           * The packet is claimed not to even have enough data for a 4-byte
 6677
6739
Show [ Lines 6677 to 6739 omitted. ]
 6740                fcs_good);
 6741            PROTO_ITEM_SET_GENERATED(fcs_item);
 6742   
 6743            fcs_item = proto_tree_add_boolean(fcs_tree,
 6744                hf_fcs_bad, tvb,
 6745                hdr_len + len, 4,
 6746                fcs_bad);
 6747            PROTO_ITEM_SET_GENERATED(fcs_item);
 6748          }
 6749        }
 6750      } else {
 6751        flag_str[8] = '\0';
 6752      }
 6753   
 6754      proto_item_append_text(ti, ", Flags: %s", flag_str);
 6755[+]     if (check_col (pinfo->cinfo, COL_INFO))
 6756        col_append_fstr (pinfo->cinfo, COL_INFO, ", Flags=%s", flag_str);
 6757   
 6758   
 6759    /*
 6760     * Only management and data frames have a body, so we don't have 
 6761     * anything more to do for other types of frames.
 6762     */
 6763    switch (FCF_FRAME_TYPE (fcf))
 6764      {
 6765   
 6766      case MGT_FRAME:
 6767        if (htc_len == 4) {
 6768          dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
 6769        }
 6770        break;
 6771   
 6772      case DATA_FRAME:
 6773        if (tree && DATA_FRAME_IS_QOS(frame_type_subtype))
 6774        {
 6775          proto_item *qos_fields;
 6776          proto_tree *qos_tree;
 6777   
 6778          guint16 qosoff;
 6779          guint16 qos_control;
 6780          guint16 qos_priority;
 6781          guint16 qos_ack_policy;
 6782          guint16 qos_amsdu_present;
 6783          guint16 qos_eosp;
 6784
6925
Show [ Lines 6784 to 6925 omitted. ]
 6926          /* Do we have +HTC? */
 6927          if (htc_len == 4) {
 6928            dissect_ht_control(hdr_tree, tvb, ohdr_len - 4);
 6929          }
 6930        } /* end of qos control field */
 6931   
 6932  #ifdef HAVE_AIRPDCAP 
 6933        /* Davide Schiera (2006-11-21): process handshake packet with AirPDcap    */
 6934        /* the processing will take care of 4-way handshake sessions for WPA    */
 6935        /* and WPA2 decryption                                  */
 6936        if (enable_decryption && !pinfo->fd->flags.visited) {
 6937          const guint8 *enc_data = tvb_get_ptr(tvb, 0, hdr_len+reported_len);
 6938          AirPDcapPacketProcess(&airpdcap_ctx, enc_data, hdr_len, hdr_len+reported_len, NULL, 0, NULL, TRUE, FALSE);
 6939        }
 6940        /* Davide Schiera --------------------------------------------------------  */
 6941  #endif
 6942   
 6943        /*
 6944         * No-data frames don't have a body.
 6945         */
 6946        if (DATA_FRAME_IS_NULL(frame_type_subtype))
 6947          return;
 6948   
 6949        if (!wlan_subdissector) {
 6950          guint fnum = 0;
 6951   
 6952          /* key: bssid:src
 6953           * data: last seq_control seen and frame number
 6954           */
 6955          retransmitted = FALSE;
 6956          if(!pinfo->fd->flags.visited){
 6957            retransmit_key key;
 6958            retransmit_key *result;
 6959   
 6960            memcpy(key.bssid, bssid, 6);
Show more  




Change Warning 2664.35151 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: