Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at packet-lapd.c:509

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

dissect_lapd

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-lapd.c)expand/collapse
Show more  
 383  dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 384  {
 385          proto_tree      *lapd_tree, *addr_tree, *checksum_tree;
 386          proto_item      *lapd_ti, *addr_ti, *checksum_ti;
 387          int             direction;
 388          guint16         control, checksum, checksum_calculated;
 389          int             lapd_header_len, checksum_offset;
 390          guint16         address, cr, sapi, tei;
 391          gboolean        is_response = 0;
 392          tvbuff_t        *next_tvb;
 393          const char      *srcname = "?";
 394          const char      *dstname = "?";
 395   
 396          if (check_col(pinfo->cinfo, COL_PROTOCOL))
 397                  col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPD");
 398[+]         if (check_col(pinfo->cinfo, COL_INFO))
 399                  col_clear(pinfo->cinfo, COL_INFO);
 400   
 401          address = tvb_get_ntohs(tvb, 0);
 402          cr = address & LAPD_CR;
 403          tei = (address & LAPD_TEI) >> LAPD_TEI_SHIFT;
 404          sapi = (address & LAPD_SAPI) >> LAPD_SAPI_SHIFT;
 405          lapd_header_len = 2;    /* address */
 406   
 407[+]         if (check_col(pinfo->cinfo, COL_TEI))
 408                  col_add_fstr(pinfo->cinfo, COL_TEI, "%u", tei);
 409   
 410          if (pinfo->fd->lnk_t == WTAP_ENCAP_LINUX_LAPD) {
 411                  /* frame is captured via libpcap */
 412                  if (pinfo->pseudo_header->lapd.pkttype == 4 /*PACKET_OUTGOING*/) {
 413                          if (pinfo->pseudo_header->lapd.we_network) {
 414                                  is_response = cr ? FALSE : TRUE;
 415                                  srcname = "Local Network";
 416                                  dstname = "Remote User";
 417                                  direction = P2P_DIR_RECV;       /* Network->User */
 418                          } else {
 419                                  srcname = "Local User";
 420                                  dstname = "Remote Network";
 421
435
Show [ Lines 421 to 435 omitted. ]
 436                                  srcname = "Remote User";
 437                                  dstname = "Local Network";
 438                                  direction = P2P_DIR_SENT;       /* User->Network */
 439                          } else {
 440                                  is_response = cr ? FALSE : TRUE;
 441                                  srcname = "Remote Network";
 442                                  dstname = "Local User";
 443                                  direction = P2P_DIR_RECV;       /* Network->User */
 444                          }
 445                  }
 446          } else {
 447                  direction = pinfo->p2p_dir;
 448                  if (pinfo->p2p_dir == P2P_DIR_RECV) {
 449                          is_response = cr ? FALSE : TRUE;
 450                          srcname = "Network";
 451                          dstname = "User";
 452                  }
 453                  else if (pinfo->p2p_dir == P2P_DIR_SENT) {
 454                          is_response = cr ? TRUE : FALSE;
 455                          srcname = "User";
 456                          dstname = "Network";
 457                  }
 458          }
 459   
 460          if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
 461              col_set_str(pinfo->cinfo, COL_RES_DL_SRC, srcname);
 462[+]         if(check_col(pinfo->cinfo, COL_RES_DL_DST))
 463              col_set_str(pinfo->cinfo, COL_RES_DL_DST, dstname);
 464   
 465          if (tree) {
 466                  proto_item *direction_ti;
 467   
 468                  lapd_ti = proto_tree_add_item(tree, proto_lapd, tvb, 0, -1,
 469                      FALSE);
 470                  lapd_tree = proto_item_add_subtree(lapd_ti, ett_lapd);
 471   
 472                  /*
 473                   * Don't show the direction if we don't know it.
 474                   */
 475                  if (direction != P2P_DIR_UNKNOWN) {
 476                          direction_ti = proto_tree_add_uint(lapd_tree, hf_lapd_direction,
 477                                                             tvb, 0, 0, pinfo->p2p_dir);
 478                          PROTO_ITEM_SET_GENERATED(direction_ti);
 479                  }
 480   
 481                  addr_ti = proto_tree_add_uint(lapd_tree, hf_lapd_address, tvb,
 482                      0, 2, address);
 483                  addr_tree = proto_item_add_subtree(addr_ti, ett_lapd_address);
 484   
 485                  if(global_lapd_gsm_sapis){
 486                          proto_tree_add_uint(addr_tree, hf_lapd_gsm_sapi,tvb, 0, 1, address);
 487                  }else{
 488                          proto_tree_add_uint(addr_tree, hf_lapd_sapi,tvb, 0, 1, address);
 489                  }
 490                  proto_tree_add_uint(addr_tree, hf_lapd_cr,  tvb, 0, 1, address);
 491                  proto_tree_add_uint(addr_tree, hf_lapd_ea1, tvb, 0, 1, address);
 492                  proto_tree_add_uint(addr_tree, hf_lapd_tei, tvb, 1, 1, address);
 493                  proto_tree_add_uint(addr_tree, hf_lapd_ea2, tvb, 1, 1, address);
 494          }
 495          else {
 496                  lapd_ti = NULL;
 497                  lapd_tree = NULL;
 498          }
 499   
 500          control = dissect_xdlc_control(tvb, 2, pinfo, lapd_tree, hf_lapd_control,
 501              ett_lapd_control, &lapd_cf_items, &lapd_cf_items_ext, NULL, NULL,
 502              is_response, TRUE, FALSE);
 503          lapd_header_len += XDLC_CONTROL_LEN(control, TRUE);
 504   
 505          if (tree)
 506                  proto_item_set_len(lapd_ti, lapd_header_len);
 507   
 508[+]         if (NULL != p_get_proto_data(pinfo->fd, proto_lapd)
 509[+]                         && ((lapd_ppi_t*)p_get_proto_data(pinfo->fd, proto_lapd))->has_crc) {
Show more  




Change Warning 2710.32202 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: