Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at packet-smb.c:8211

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

dissect_nt_transaction_request

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-smb.c)expand/collapse
Show more  
 8514  dissect_nt_transaction_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, proto_tree *smb_tree _U_)
 8515  {
 8516          guint8 wc, sc;
 8517          guint32 pc=0, po=0, pd, dc=0, od=0, dd;
 8518          smb_info_t *si;
 8519          smb_saved_info_t *sip;
 8520          int subcmd;
 8521          nt_trans_data ntd;
 8522          guint16 bc;
 8523          guint32 padcnt;
 8524          smb_nt_transact_info_t *nti=NULL;
 8525   
 8526          ntd.subcmd = ntd.sd_len = ntd.ea_len = 0;
 8527   
 8528          si = (smb_info_t *)pinfo->private_data;
 8529          DISSECTOR_ASSERT(si);
 8530          sip = si->sip;
 8531   
 8532          WORD_COUNT;
 8533   
 8534          if(wc>=19){
 8535                  /* primary request */
 8536                  /* max setup count */
 8537                  proto_tree_add_item(tree, hf_smb_max_setup_count, tvb, offset, 1, TRUE);
 8538                  offset += 1;
 8539   
 8540                  /* 2 reserved bytes */
 8541                  proto_tree_add_item(tree, hf_smb_reserved, tvb, offset, 2, TRUE);
 8542                  offset += 2;
 8543          } else {
 8544                  /* secondary request */
 8545                  /* 3 reserved bytes */
 8546                  proto_tree_add_item(tree, hf_smb_reserved, tvb, offset, 3, TRUE);
 8547                  offset += 3;
 8548          }
 8549   
 8550   
 8551          /* total param count */
 8552          proto_tree_add_item(tree, hf_smb_total_param_count, tvb, offset, 4, TRUE);
 8553          offset += 4;
 8554   
 8555          /* total data count */
 8556          proto_tree_add_item(tree, hf_smb_total_data_count, tvb, offset, 4, TRUE);
 8557          offset += 4;
 8558   
 8559          if(wc>=19){
 8560                  /* primary request */
 8561                  /* max param count */
 8562                  proto_tree_add_item(tree, hf_smb_max_param_count, tvb, offset, 4, TRUE);
 8563                  offset += 4;
 8564   
 8565                  /* max data count */
 8566                  proto_tree_add_item(tree, hf_smb_max_data_count, tvb, offset, 4, TRUE);
 8567                  offset += 4;
 8568          }
 8569   
 8570          /* param count */
 8571[+]         pc = tvb_get_letohl(tvb, offset);
 8572          proto_tree_add_uint(tree, hf_smb_param_count32, tvb, offset, 4, pc);
 8573          offset += 4;
 8574   
 8575          /* param offset */
 8576[+]         po = tvb_get_letohl(tvb, offset);
 8577          proto_tree_add_uint(tree, hf_smb_param_offset32, tvb, offset, 4, po);
 8578          offset += 4;
 8579   
 8580          /* param displacement */
 8581          if(wc>=19){
 8582                  /* primary request*/
 8583                  pd = 0;
 8584          } else {
 8585                  /* secondary request */
 8586                  pd = tvb_get_letohl(tvb, offset);
 8587                  proto_tree_add_uint(tree, hf_smb_param_disp32, tvb, offset, 4, pd);
 8588                  offset += 4;
 8589          }
 8590   
 8591          /* data count */
 8592[+]         dc = tvb_get_letohl(tvb, offset);
 8593          proto_tree_add_uint(tree, hf_smb_data_count32, tvb, offset, 4, dc);
 8594          offset += 4;
 8595   
 8596          /* data offset */
 8597          od = tvb_get_letohl(tvb, offset);
 8598          proto_tree_add_uint(tree, hf_smb_data_offset32, tvb, offset, 4, od);
 8599          offset += 4;
 8600   
 8601          /* data displacement */
 8602          if(wc>=19){
 8603                  /* primary request */
 8604                  dd = 0;
 8605          } else {
 8606                  /* secondary request */
 8607                  dd = tvb_get_letohl(tvb, offset);
 8608                  proto_tree_add_uint(tree, hf_smb_data_disp32, tvb, offset, 4, dd);
 8609                  offset += 4;
 8610          }
 8611   
 8612          /* setup count */
 8613          if(wc>=19){
 8614                  /* primary request */
 8615[+]                 sc = tvb_get_guint8(tvb, offset);
 8616                  proto_tree_add_uint(tree, hf_smb_setup_count, tvb, offset, 1, sc);
 8617                  offset += 1;
 8618          } else {
 8619                  /* secondary request */
 8620                  sc = 0;
 8621          }
 8622   
 8623          /* function */
 8624          if(wc>=19){
 8625                  /* primary request */
 8626                  subcmd = tvb_get_letohs(tvb, offset);
 8627                  proto_tree_add_uint(tree, hf_smb_nt_trans_subcmd, tvb, offset, 2, subcmd);
 8628                  if(check_col(pinfo->cinfo, COL_INFO)){
 8629                          col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
 8630                                  val_to_str(subcmd, nt_cmd_vals, "<unknown>"));
 8631                  }
 8632                  ntd.subcmd = subcmd;
 8633                  if (!si->unidir && sip) {
 8634                          if(!pinfo->fd->flags.visited){
 8635                                  /*
 8636                                   * Allocate a new smb_nt_transact_info_t
 8637                                   * structure.
 8638                                   */
 8639                                  nti = se_alloc(sizeof(smb_nt_transact_info_t));
 8640                                  nti->subcmd = subcmd;
 8641                                  nti->fid_type=SMB_FID_TYPE_UNKNOWN;
 8642                                  sip->extra_info = nti;
 8643                                  sip->extra_info_type = SMB_EI_NTI;
 8644                          } else {
 8645                                  if(sip->extra_info_type == SMB_EI_NTI){
 8646                                          nti=sip->extra_info;
 8647                                  }
 8648                          }
 8649                  }
 8650          } else {
 8651                  /* secondary request */
 8652                  if(check_col(pinfo->cinfo, COL_INFO)){
 8653                          col_append_str(pinfo->cinfo, COL_INFO, " (secondary request)");
 8654                  }
 8655          }
 8656          offset += 2;
 8657   
 8658          /* this is a padding byte */
 8659          if(offset%1){
 8660                  /* pad byte */
 8661                  proto_tree_add_item(tree, hf_smb_padding, tvb, offset, 1, TRUE);
 8662                  offset += 1;
 8663          }
 8664   
 8665          /* if there were any setup bytes, decode them */
 8666          if(sc){
 8667                  dissect_nt_trans_setup_request(tvb, pinfo, offset, tree, sc*2, &ntd);
 8668                  offset += sc*2;
 8669          }
 8670   
 8671[+]         BYTE_COUNT;
 8672   
 8673          /* parameters */
 8674          if(po>(guint32)offset){
 8675                  /* We have some initial padding bytes.
 8676                  */
 8677                  padcnt = po-offset;
 8678                  if (padcnt > bc)
 8679                          padcnt = bc;
 8680                  CHECK_BYTE_COUNT(padcnt);
 8681                  proto_tree_add_item(tree, hf_smb_padding, tvb, offset, padcnt, TRUE);
 8682                  COUNT_BYTES(padcnt);
 8683          }
 8684          if(pc){
 8685                  CHECK_BYTE_COUNT(pc);
 8686                  dissect_nt_trans_param_request(tvb, pinfo, offset, tree, pc, &ntd, bc, nti);
 8687                  COUNT_BYTES(pc);
 8688          }
 8689   
 8690          /* data */
 8691          if(od>(guint32)offset){
 8692                  /* We have some initial padding bytes.
 8693                  */
 8694                  padcnt = od-offset;
 8695                  if (padcnt > bc)
 8696                          padcnt = bc;
 8697                  proto_tree_add_item(tree, hf_smb_padding, tvb, offset, padcnt, TRUE);
 8698                  COUNT_BYTES(padcnt);
 8699          }
 8700          if(dc){
 8701                  CHECK_BYTE_COUNT(dc);
 8702                  dissect_nt_trans_data_request(
 8703[+]                         tvb, pinfo, offset, tree, dc, &ntd, nti);
expand/collapse

dissect_nt_trans_data_request

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-smb.c)expand/collapse
Show more  
 8170  dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, int bc, nt_trans_data *ntd, smb_nt_transact_info_t *nti)
 8171  {
 8172          proto_item *item = NULL;
 8173          proto_tree *tree = NULL;
 8174          smb_info_t *si;
 8175          int old_offset = offset;
 8176          guint16 bcp=bc; /* XXX fixme */
 8177          struct access_mask_info *ami=NULL;
 8178          tvbuff_t *ioctl_tvb;
 8179   
 8180          si = (smb_info_t *)pinfo->private_data;
 8181   
 8182          DISSECTOR_ASSERT(si);
 8183   
 8184          if(parent_tree){
 8185                  tvb_ensure_bytes_exist(tvb, offset, bc);
 8186                  item = proto_tree_add_text(parent_tree, tvb, offset, bc,
 8187                                  "%s Data",
 8188                                  val_to_str(ntd->subcmd, nt_cmd_vals, "Unknown NT transaction (%u)"));
 8189                  tree = proto_item_add_subtree(item, ett_smb_nt_trans_data);
 8190          }
 8191   
 8192          switch(ntd->subcmd){
 8193          case NT_TRANS_CREATE:
 8194                  /* security descriptor */
 8195                  if(ntd->sd_len){
 8196                          offset = dissect_nt_sec_desc(
 8197                                  tvb, offset, pinfo, tree, NULL, TRUE,
 8198                                  ntd->sd_len, NULL);
 8199                  }
 8200   
 8201                  /* extended attributes */
 8202                  if(ntd->ea_len){
 8203                          proto_tree_add_item(tree, hf_smb_extended_attributes, tvb, offset, ntd->ea_len, TRUE);
 8204                          offset += ntd->ea_len;
 8205                  }
 8206   
 8207                  break;
 8208          case NT_TRANS_IOCTL:
 8209                  /* ioctl data */
 8210                  ioctl_tvb=tvb_new_subset(tvb, offset, MIN((int)bc, tvb_length_remaining(tvb, offset)), bc);
 8211                  dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree, nti->ioctl_function, TRUE);
Show more  
Show more  




Change Warning 2966.35215 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: