Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at packet-scsi.c:2306

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

dissect_spc_inquiry

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-scsi.c)expand/collapse
Show more  
 2238  dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo,
 2239                       proto_tree *tree, guint offset, gboolean isreq,
 2240                       gboolean iscdb, guint32 payload_len,
 2241                       scsi_task_data_t *cdata)
 2242  {
 2243      guint8 flags, i;
 2244      tvbuff_t *volatile tvb_v = tvb;
 2245      volatile guint offset_v = offset;
 2246   
 2247      static const int *peripheal_fields[] = {
 2248          &hf_scsi_inq_qualifier,
 2249              &hf_scsi_inq_devtype,
 2250              NULL 
 2251      };
 2252      static const int *aca_fields[] = {
 2253          &hf_scsi_inq_aerc,      /* obsolete in spc3 and forward */
 2254              &hf_scsi_inq_trmtsk,        /* obsolete in spc2 and forward */
 2255              &hf_scsi_inq_normaca,
 2256              &hf_scsi_inq_hisup,
 2257              &hf_scsi_inq_rdf,
 2258              NULL 
 2259      };
 2260      static const int *rmb_fields[] = {
 2261          &hf_scsi_inq_rmb,
 2262              NULL 
 2263      };
 2264   
 2265      if (!isreq && (cdata == NULL || !(cdata->itlq->flags & 0x3))
 2266          && (tvb_length_remaining(tvb_v, offset_v)>=1) ) {
 2267          /*
 2268          * INQUIRY response with device type information; add device type 
 2269          * to list of known devices & their types if not already known.
 2270          */
 2271          if(cdata && cdata->itl){
 2272              cdata->itl->cmdset=tvb_get_guint8(tvb_v, offset_v)&SCSI_DEV_BITS;
 2273          }
 2274      }
 2275   
 2276      if (isreq && iscdb) {
 2277          flags = tvb_get_guint8 (tvb_v, offset_v);
 2278          if (cdata) {
 2279              cdata->itlq->flags = flags;
 2280          }
 2281   
 2282          proto_tree_add_uint_format (tree, hf_scsi_inquiry_flags, tvb_v, offset_v, 1,
 2283              flags, "CMDT = %u, EVPD = %u",
 2284              flags & 0x2, flags & 0x1);
 2285          if (flags & 0x1) {
 2286              proto_tree_add_item (tree, hf_scsi_inquiry_evpd_page, tvb_v, offset_v+1,
 2287                  1, 0);
 2288          }
 2289          else if (flags & 0x2) {
 2290              proto_tree_add_item (tree, hf_scsi_inquiry_cmdt_page, tvb_v, offset_v+1,
 2291                  1, 0);
 2292          }
 2293   
 2294          proto_tree_add_item (tree, hf_scsi_alloclen, tvb_v, offset_v+3, 1, 0);
 2295          /* we need the alloc_len in the response */
 2296          if(cdata){
 2297              cdata->itlq->alloc_len=tvb_get_guint8(tvb_v, offset_v+3);
 2298          }
 2299   
 2300          flags = tvb_get_guint8 (tvb_v, offset_v+4);
 2301          proto_tree_add_uint_format (tree, hf_scsi_control, tvb_v, offset_v+4, 1,
 2302              flags,
 2303              "Vendor Unique = %u, NACA = %u, Link = %u",
 2304              flags & 0xC0, flags & 0x4, flags & 0x1);
 2305      } else if (!isreq) {
 2306          if (!cdata) {
 2307              return;
 2308          }
 2309   
 2310          if (cdata->itlq->flags & 0x1) {
 2311              dissect_scsi_evpd (tvb_v, pinfo, tree, offset_v, payload_len);
 2312              return;
 2313          }
 2314          if (cdata->itlq->flags & 0x2) {
 2315              dissect_scsi_cmddt (tvb_v, pinfo, tree, offset_v, payload_len);
 2316              return;
 2317          }
 2318   
 2319          /* These pdus are sometimes truncated by SCSI allocation length 
 2320          * in the CDB 
 2321          */
 2322          TRY_SCSI_CDB_ALLOC_LEN(pinfo, tvb_v, offset_v, cdata->itlq->alloc_len);
 2323   
 2324          /* Qualifier and DeviceType */
 2325          proto_tree_add_bitmask(tree, tvb_v, offset_v, hf_scsi_inq_peripheral, ett_scsi_inq_peripheral, peripheal_fields, FALSE);
 2326          offset_v+=1;
 2327   
 2328          /* RMB */
 2329          proto_tree_add_bitmask(tree, tvb_v, offset_v, hf_scsi_inq_rmbflags, ett_scsi_inq_rmbflags, rmb_fields, FALSE);
 2330          offset_v+=1;
 2331   
 2332          /* Version */
 2333          proto_tree_add_item (tree, hf_scsi_inq_version, tvb_v, offset_v, 1, 0);
 2334          offset_v+=1;
 2335   
 2336          /* aca flags */
 2337          proto_tree_add_bitmask(tree, tvb_v, offset_v, hf_scsi_inq_acaflags, ett_scsi_inq_acaflags, aca_fields, FALSE);
 2338          offset_v+=1;
 2339   
 2340          /* Additional Length */
 2341          SET_SCSI_DATA_END(tvb_get_guint8(tvb_v, offset_v)+offset);
 2342          proto_tree_add_item(tree, hf_scsi_inq_add_len, tvb_v, offset_v, 1, 0);
 2343          offset_v+=1;
 2344   
 2345          /* sccs flags */
 2346          offset_v=dissect_spc_inq_sccsflags(tvb_v, offset_v, tree);
 2347   
 2348          /* bque flags */
 2349          offset_v=dissect_spc_inq_bqueflags(tvb_v, offset_v, tree);
 2350   
 2351          /* reladdr flags */
 2352          offset_v=dissect_spc_inq_reladrflags(tvb_v, offset_v, tree);
 2353   
 2354          /* vendor id */
 2355          proto_tree_add_item(tree, hf_scsi_inq_vendor_id, tvb_v, offset_v, 8, 0);
 2356          offset_v+=8;
 2357   
 2358          /* product id */
 2359          proto_tree_add_item(tree, hf_scsi_inq_product_id, tvb_v, offset_v, 16, 0);
 2360          offset_v+=16;
 2361   
 2362          /* product revision level */
 2363          proto_tree_add_item(tree, hf_scsi_inq_product_rev, tvb_v, offset_v, 4, 0);
 2364          offset_v+=4;
 2365   
 2366          /* vendor specific, 20 bytes */
 2367          proto_tree_add_item(tree, hf_scsi_inq_vendor_specific, tvb_v, offset_v, 20, 0);
 2368          offset_v+=20;
 2369   
 2370          proto_tree_add_item(tree, hf_scsi_inq_reserved, tvb_v, offset_v, 2, 0);
 2371          /* clocking, qas, ius */
 2372          offset_v++;
 2373   
 2374          /* reserved */
 2375          offset_v++;
 2376   
 2377          /* version descriptors */
 2378          for(i=0;i<8;i++){
 2379              proto_tree_add_item(tree, hf_scsi_inq_version_desc, tvb_v, offset_v, 2, 0);
 2380              offset_v+=2;
 2381          }
 2382   
 2383          END_TRY_SCSI_CDB_ALLOC_LEN;
 2384      }
 2385  }
Show more  




Change Warning 12397.33637 : Null Test After Dereference

Priority:
State:
Finding:
Owner:
Note: