Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at packet-smb.c:9101

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

dissect_nt_transaction_response

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-smb.c)expand/collapse
Show more  
 9081  dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_)
 9082  {
 9083          guint8 wc, sc;
 9084          guint32 pc=0, po=0, pd=0, dc=0, od=0, dd=0;
 9085          guint32 td=0, tp=0;
 9086          smb_info_t *si;
 9087          smb_nt_transact_info_t *nti=NULL;
 9088          static nt_trans_data ntd;
 9089          guint16 bc;
 9090          gint32 padcnt;
 9091          fragment_data *r_fd = NULL;
 9092          tvbuff_t *pd_tvb=NULL;
 9093          gboolean save_fragmented;
 9094   
 9095          si = (smb_info_t *)pinfo->private_data;
 9096          DISSECTOR_ASSERT(si);
 9097   
 9098          if (si->sip != NULL && si->sip->extra_info_type == SMB_EI_NTI)
 9099                  nti = si->sip->extra_info;
 9100          else 
 9101                  nti = NULL;
 9102   
 9103          /* primary request */
 9104          if(nti != NULL){
 9105                  proto_tree_add_uint(tree, hf_smb_nt_trans_subcmd, tvb, 0, 0, nti->subcmd);
 9106                  if(check_col(pinfo->cinfo, COL_INFO)){
 9107                          col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
 9108                                  val_to_str(nti->subcmd, nt_cmd_vals, "<unknown (%u)>"));
 9109                  }
 9110          } else {
 9111                  proto_tree_add_text(tree, tvb, offset, 0,
 9112                          "Function: <unknown function - could not find matching request>");
 9113                  if(check_col(pinfo->cinfo, COL_INFO)){
 9114                          col_append_str(pinfo->cinfo, COL_INFO, ", <unknown>");
 9115                  }
 9116          }
 9117   
 9118          WORD_COUNT;
 9119   
 9120          /* 3 reserved bytes */
 9121          proto_tree_add_item(tree, hf_smb_reserved, tvb, offset, 3, TRUE);
 9122          offset += 3;
 9123   
 9124          /* total param count */
 9125          tp = tvb_get_letohl(tvb, offset);
 9126          proto_tree_add_uint(tree, hf_smb_total_param_count, tvb, offset, 4, tp);
 9127          offset += 4;
 9128   
 9129          /* total data count */
 9130          td = tvb_get_letohl(tvb, offset);
 9131          proto_tree_add_uint(tree, hf_smb_total_data_count, tvb, offset, 4, td);
 9132          offset += 4;
 9133   
 9134          /* param count */
 9135          pc = tvb_get_letohl(tvb, offset);
 9136          proto_tree_add_uint(tree, hf_smb_param_count32, tvb, offset, 4, pc);
 9137          offset += 4;
 9138   
 9139          /* param offset */
 9140          po = tvb_get_letohl(tvb, offset);
 9141          proto_tree_add_uint(tree, hf_smb_param_offset32, tvb, offset, 4, po);
 9142          offset += 4;
 9143   
 9144          /* param displacement */
 9145          pd = tvb_get_letohl(tvb, offset);
 9146          proto_tree_add_uint(tree, hf_smb_param_disp32, tvb, offset, 4, pd);
 9147          offset += 4;
 9148   
 9149          /* data count */
 9150          dc = tvb_get_letohl(tvb, offset);
 9151          proto_tree_add_uint(tree, hf_smb_data_count32, tvb, offset, 4, dc);
 9152          offset += 4;
 9153   
 9154          /* data offset */
 9155          od = tvb_get_letohl(tvb, offset);
 9156          proto_tree_add_uint(tree, hf_smb_data_offset32, tvb, offset, 4, od);
 9157          offset += 4;
 9158   
 9159          /* data displacement */
 9160          dd = tvb_get_letohl(tvb, offset);
 9161          proto_tree_add_uint(tree, hf_smb_data_disp32, tvb, offset, 4, dd);
 9162          offset += 4;
 9163   
 9164          /* setup count */
 9165          sc = tvb_get_guint8(tvb, offset);
 9166          proto_tree_add_uint(tree, hf_smb_setup_count, tvb, offset, 1, sc);
 9167          offset += 1;
 9168   
 9169          /* setup data */
 9170          if(sc){
 9171                  dissect_nt_trans_setup_response(tvb, pinfo, offset, tree, sc*2, &ntd);
 9172                  offset += sc*2;
 9173          }
 9174   
 9175          BYTE_COUNT;
 9176   
 9177          /* reassembly of SMB NT Transaction data payload.
 9178             In this section we do reassembly of both the data and parameters 
 9179             blocks of the SMB transaction command.
 9180          */
 9181          save_fragmented = pinfo->fragmented;
 9182          /* do we need reassembly? */
 9183          if( (td&&(td!=dc)) || (tp&&(tp!=pc)) ){
 9184                  /* oh yeah, either data or parameter section needs
 9185                     reassembly...
 9186                  */
 9187                  pinfo->fragmented = TRUE;
 9188                  if(smb_trans_reassembly){
 9189                          /* ...and we were told to do reassembly */
 9190                          if(pc && ((unsigned int)tvb_length_remaining(tvb, po)>=pc) ){
 9191                                  r_fd = smb_trans_defragment(tree, pinfo, tvb,
 9192                                                               po, pc, pd, td+tp);
 9193   
 9194                          }
 9195                          if((r_fd==NULL) && dc && ((unsigned int)tvb_length_remaining(tvb, od)>=dc) ){
 9196                                  r_fd = smb_trans_defragment(tree, pinfo, tvb,
 9197                                                               od, dc, dd+tp, td+tp);
 9198                          }
 9199                  }
 9200          }
 9201   
 9202          /* if we got a reassembled fd structure from the reassembly routine we
 9203             must create pd_tvb from it
 9204          */
 9205          if(r_fd){
 9206          proto_item *frag_tree_item;
 9207   
 9208                  pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
 9209                                               r_fd->datalen);
 9210                  tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
 9211                  add_new_data_source(pinfo, pd_tvb, "Reassembled SMB");
 9212   
 9213                  show_fragment_tree(r_fd, &smb_frag_items, tree, pinfo, pd_tvb, &frag_tree_item);
 9214          }
 9215   
 9216   
 9217          if(pd_tvb){
 9218            /* we have reassembled data, grab param and data from there */
 9219            dissect_nt_trans_param_response(pd_tvb, pinfo, 0, tree, tp,
 9220                                            &ntd, (guint16) tvb_length(pd_tvb));
 9221            dissect_nt_trans_data_response(pd_tvb, pinfo, tp, tree, td, &ntd, nti);
 9222          } else {
 9223            /* we do not have reassembled data, just use what we have in the 
 9224               packet as well as we can */
 9225            /* parameters */
 9226            if(po>(guint32)offset){
 9227              /* We have some initial padding bytes.
 9228               */
 9229              padcnt = po-offset;
 9230              if (padcnt > bc)
 9231                padcnt = bc;
 9232              CHECK_BYTE_COUNT(padcnt);
 9233              proto_tree_add_item(tree, hf_smb_padding, tvb, offset, padcnt, TRUE);
 9234              COUNT_BYTES(padcnt);
 9235            }
 9236            if(pc){
 9237              CHECK_BYTE_COUNT(pc);
 9238              dissect_nt_trans_param_response(tvb, pinfo, offset, tree, pc, &ntd, bc);
 9239              COUNT_BYTES(pc);
 9240            }
 9241   
 9242            /* data */
 9243            if(od>(guint32)offset){
 9244              /* We have some initial padding bytes.
 9245               */
 9246              padcnt = od-offset;
 9247              if (padcnt > bc)
 9248                padcnt = bc;
 9249              proto_tree_add_item(tree, hf_smb_padding, tvb, offset, padcnt, TRUE);
 9250              COUNT_BYTES(padcnt);
 9251            }
 9252            if(dc){
 9253              CHECK_BYTE_COUNT(dc);
 9254              dissect_nt_trans_data_response(tvb, pinfo, offset, tree, dc, &ntd, nti);
 9255              COUNT_BYTES(dc);
 9256            }
 9257          }
 9258          pinfo->fragmented = save_fragmented;
 9259   
 9260          END_OF_SMB 
 9261   
 9262          return offset;
 9263  }
Show more  




Change Warning 2968.35216 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: