Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at proto.c:757

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

dissect_nds_request

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ncp2222.inc)expand/collapse
Show more  
 9328  dissect_nds_request(tvbuff_t *tvb, packet_info *pinfo,
 9329                  guint32 nw_connection, guint8 sequence,
 9330                  guint16 type, proto_tree *ncp_tree)
 9331  {
 9332          guint8                  func, subfunc = 0;
 9333          ncp_req_hash_value      *request_value = NULL;
 9334          ncp_req_eid_hash_value  *request_eid_value = NULL;
 9335          const ncp_record        *ncp_rec = NULL;
 9336          conversation_t          *conversation;
 9337          ptvcursor_t             *ptvc = NULL;
 9338          proto_tree              *temp_tree = NULL;
 9339          gboolean                run_req_cond = FALSE;
 9340          gboolean                run_info_str = FALSE;
 9341          guint8                  nds_verb = 0;
 9342          const char              *verb_string = "";
 9343          guint32                 nds_frag = 0;
 9344          gboolean                added_arrow;
 9345          nds_val                 pvalues[9], prot_flags[1];
 9346          guint8                  nds_version = 0;
 9347          guint32                 foffset = 0;
 9348          char                    global_object_name[256];
 9349          guint32                 global_eid=0;
 9350          gboolean                resolve_eid=FALSE;
 9351          guint32                 global_flags=0, nds_prot_flags=0;
 9352          int                                 i;
 9353   
 9354          for (i = 0; i < 9; i++) {
 9355                  pvalues[i].vtype = 0;
 9356                  pvalues[i].vvalue = 0;
 9357                  pvalues[i].vlength = 0;
 9358                  pvalues[i].voffset = 0;
 9359                  pvalues[i].hfname = 0;
 9360                  pvalues[i].vdesc = "";
 9361                  pvalues[i].vstring = NULL;
 9362                  pvalues[i].mvtype = 0;
 9363                  pvalues[i].vflags = 0;
 9364          }
 9365   
 9366          global_object_name[0] = '\0';
 9367   
 9368          func = tvb_get_guint8(tvb, 6);
 9369          subfunc = tvb_get_guint8(tvb, 7);
 9370   
 9371          ncp_rec = ncp_record_find(func, subfunc);
 9372   
 9373          /* Check to see if this is a fragment packet */
 9374          nds_frag = tvb_get_letohl(tvb, 8);
 9375   
 9376          /* Get NDS Verb */
 9377          if (nds_frag == 0xffffffff) {
 9378                  /* First fragment or only fragment. */
 9379                  nds_verb = tvb_get_guint8(tvb, 24);
 9380                  if (nds_verb == 0xfe)
 9381                  {
 9382                          nds_version = nds_verb;
 9383                          nds_verb = tvb_get_guint8(tvb, 32);
 9384                          foffset = 36;
 9385                  }
 9386                  else 
 9387                  {
 9388
11712
Show [ Lines 9388 to 11712 omitted. ]
 11713                                  pvalues[5].hfname= hf_nds_iterator;
 11714                                  pvalues[5].mvtype = MVTYPE_PROCESS_ITERATOR;
 11715                                  foffset = foffset+pvalues[5].vlength;
 11716                                  break;
 11717                          default:
 11718                                  pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
 11719                                  break;
 11720                  }
 11721          }
 11722          /* Fill in the INFO column. */
 11723[+]         if (check_col(pinfo->cinfo, COL_INFO)) {
 11724                  if (ncp_rec) {
 11725                          col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
 11726                          if (nds_frag != 0xffffffff) {
 11727                                  col_add_fstr(pinfo->cinfo, COL_INFO, "C Continue NDS Fragment 0x%08x", nds_frag);
 11728                          }
 11729                          else {
 11730                                  col_add_fstr(pinfo->cinfo, COL_INFO, "C NDS %s", verb_string);
 11731                          }
 11732                          run_info_str = TRUE;
 11733                  }
 11734                  else {
 11735                          col_add_fstr(pinfo->cinfo, COL_INFO,
 11736                                  "C Unknown Function %d (0x%02x)",
 11737                                  func, func);
 11738                  }
 11739   
 11740          }
 11741          /* Keep track of the address and connection whence the request
 11742             came, and the address and connection to which the request 
 11743             is being sent, so that we can match up calls with replies.
 11744             (We don't include the sequence number, as we may want
 11745             to have all packets over the same connection treated
 11746             as being part of a single conversation so that we can
 11747             let the user select that conversation to be displayed.) */
 11748   
 11749          conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
 11750[+]                     PT_NCP, nw_connection, nw_connection, 0);
 11751          if (conversation == NULL) {
 11752                  /* It's not part of any conversation - create a new one. */
 11753                  conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
 11754                      PT_NCP, nw_connection, nw_connection, 0);
 11755          }
 11756   
 11757          if (!pinfo->fd->flags.visited) {
 11758                  request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
 11759                  request_value->req_frame_num = pinfo->fd->num;
 11760                  request_value->req_frame_time=pinfo->fd->abs_ts;
 11761   
 11762                  /* If this is the first time we're examining the packet,
 11763                   * check to see if this NCP type uses a "request condition".
 11764                   * If so, we have to build a proto_tree because request conditions 
 11765                   * use display filters to work, and without a proto_tree,
 11766                   * display filters can't possibly work. If we already have
 11767                   * a proto_tree, then wonderful. If we don't, we need to build
 11768                   * one. */
 11769                  if (ncp_rec && !ncp_tree) {
 11770                          run_req_cond = TRUE;
 11771                  }
 11772                  /* Keep track of the Fragment number in the request for defrag logic */
 11773                  request_value->nds_frag_num = nds_frag;
 11774          }
 11775   
 11776          /* If we have to handle a request condition, or have to 
 11777             add to the Info column, we need to construct a protocol
 11778             tree.  If we already have a proto_tree, then wonderful.
 11779             If we don't, we need to build one. */
 11780          if ((run_info_str || run_req_cond) && !ncp_tree) {
 11781                  proto_item *ti;
 11782   
 11783                  temp_tree = proto_tree_create_root();
 11784                  proto_tree_set_visible(temp_tree, FALSE);
 11785                  ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
 11786                  ncp_tree = proto_item_add_subtree(ti, ett_ncp);
 11787          }
 11788   
 11789          if (ncp_tree) {
 11790                  /* If the dissection throws an exception, be sure to free
 11791                   * the temporary proto_tree that was created. Because of the 
 11792                   * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
 11793                   * block; it has to be in the same scope as the terminating 
 11794                   * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
 11795                   * call CLEANUP_POP and friends, but the value of temp_tree is
 11796                   * NULL if no cleanup is needed, and non-null if cleanup is needed.
 11797                   */
 11798                  CLEANUP_PUSH(free_proto_tree, temp_tree);
 11799   
 11800  #ifdef FAKE_TREE_IS_VISIBLE 
 11801                  PTREE_DATA(ncp_tree)->visible=1;
 11802  #endif
 11803   
 11804                  request_value = ncp_hash_lookup(conversation, sequence);
 11805                  switch (type) {
 11806                          case NCP_BROADCAST_SLOT:
 11807                                  ; /* nothing */
 11808                                  break;
 11809   
 11810                          case NCP_SERVICE_REQUEST:
 11811   
 11812                                  ptvc = ptvcursor_new(ncp_tree, tvb, 7);
 11813                                  if (ncp_rec && ncp_rec->request_ptvc)
 11814                                  {
 11815                                          clear_repeat_vars();
 11816
11992
Show [ Lines 11816 to 11992 omitted. ]
 11993                                          {
 11994                                                  request_value->nds_request_verb = nds_verb;
 11995                                                  request_value->nds_version = nds_version;
 11996                                                  g_strlcpy(request_value->object_name, global_object_name, 256);
 11997                                                  request_value->req_nds_flags = global_flags;
 11998                                                  request_value->req_nds_prot_flags = nds_prot_flags;
 11999                                          }
 12000                                  }
 12001                                  break;
 12002   
 12003                          default:
 12004                                  ; /* nothing */
 12005                                  break;
 12006                  }
 12007[+]                 ptvcursor_free(ptvc);
expand/collapse

ptvcursor_free

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 783  ptvcursor_free(ptvcursor_t *ptvc)
 784  {
 785[+]         ptvcursor_free_subtree_levels(ptvc);
expand/collapse

ptvcursor_free_subtree_levels

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 755  ptvcursor_free_subtree_levels(ptvcursor_t * ptvc)
 756  {
 757          ptvc->pushed_tree = NULL;
Show more  
Show more  
Show more  




Change Warning 2836.34808 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: