Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at wlan_stat_dlg.c:430

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

wlanstat_packet

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/wlan_stat_dlg.c)expand/collapse
Show more  
 360  wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *phi)
 361  {
 362   
 363          wlanstat_t *hs = (wlanstat_t *)phs;
 364          wlan_ep_t *tmp = NULL, *te = NULL;
 365          struct _wlan_hdr *si = (struct _wlan_hdr *) phi;
 366   
 367          if (!hs)
 368                  return (0);
 369   
 370          hs->number_of_packets++;
 371          if (!hs->ep_list) {
 372                  hs->ep_list = alloc_wlan_ep (si, pinfo);
 373                  te = hs->ep_list;
 374          } else {
 375                  for (tmp = hs->ep_list; tmp; tmp = tmp->next) {
 376                          if (((si->type == 0x04) &&
 377                               (((tmp->stats.ssid_len == 0) && (si->stats.ssid_len == 0) &&
 378                                 (strcmp (get_addr_name(&tmp->bssid), "Broadcast") == 0)) ||
 379                                (si->stats.ssid_len != 0 &&
 380                                 (tmp->stats.ssid_len == si->stats.ssid_len) &&
 381                                 (memcmp (tmp->stats.ssid, si->stats.ssid, si->stats.ssid_len) == 0)))) ||
 382                              ((si->type != 0x04) &&
 383                               (!CMP_ADDRESS (&tmp->bssid, &si->bssid)))) {
 384                                  te = tmp;
 385                                  break;
 386                          }
 387                  }
 388   
 389                  if (!te) {
 390                          if ((te = alloc_wlan_ep (si, pinfo))) {
 391                                  te->next = hs->ep_list;
 392                                  hs->ep_list = te;
 393                          }
 394                  }
 395   
 396                  if (!te->probe_req_searched && (si->type != 0x04) && (te->type[0x04] == 0) &&
 397                      (si->stats.ssid_len > 1 || si->stats.ssid[0] != 0)) {
 398                          /*
 399                           * We have found a matching entry without Probe Requests.
 400                           * Search the rest of the entries for a corresponding entry
 401                           * matching the SSID and BSSID == Broadcast.
 402                           *
 403                           * This is because we can have a hidden SSID or Probe Request
 404                           * before we have a Beacon, Association Request, etc.
 405                           */
 406                          wlan_ep_t *prev = NULL;
 407                          GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(hs->table));
 408                          te->probe_req_searched = TRUE;
 409                          for (tmp = hs->ep_list; tmp; tmp = tmp->next) {
 410                                  if ((si->stats.ssid_len == tmp->stats.ssid_len) &&
 411                                      (memcmp (si->stats.ssid, tmp->stats.ssid, tmp->stats.ssid_len) == 0) &&
 412                                      (strcmp (get_addr_name(&tmp->bssid), "Broadcast") == 0)) {
 413                                          /*
 414                                           * Found a matching entry. Merge with the previous
 415                                           * found entry and remove from list.
 416                                           */
 417                                          te->type[0x04] += tmp->type[0x04];
 418                                          te->number_of_packets += tmp->number_of_packets;
 419   
 420                                          if (tmp->details && tmp->details->next) {
 421                                                  /* Adjust received probe requests */
 422                                                  wlan_details_ep_t *d_te;
 423                                                  d_te = get_details_ep (te, &tmp->details->address);
 424                                                  d_te->probe_req += tmp->type[0x04];
 425                                                  d_te->number_of_packets += tmp->type[0x04];
 426                                                  d_te = get_details_ep (te, &tmp->details->next->address);
 427                                                  d_te->probe_req += tmp->type[0x04];
 428                                                  d_te->number_of_packets += tmp->type[0x04];
 429                                          }
 430                                          if (prev) {
 431                                                  prev->next = tmp->next;
 432                                          } else {
 433                                                  hs->ep_list = tmp->next;
 434                                          }
 435                                          dealloc_wlan_details_ep (tmp->details);
 436                                          if (tmp->iter_valid) {
 437                                                  gtk_list_store_remove(store, &tmp->iter);
 438                                          }
 439                                          g_free (tmp);
 440                                          break;
 441                                  }
 442                                  prev = tmp;
 443                          }
 444                  }
 445          }
 446   
 447          if(!te)
 448                  return (0);
 449   
 450          if (te->stats.channel == 0 && si->stats.channel != 0) {
 451                  te->stats.channel = si->stats.channel;
 452          }
 453          if (te->stats.ssid[0] == 0 && si->stats.ssid_len != 0) {
 454                  memcpy (te->stats.ssid, si->stats.ssid, MAX_SSID_LEN);
 455                  te->stats.ssid_len = si->stats.ssid_len;
 456          }
 457          if (te->stats.protection[0] == 0 && si->stats.protection[0] != 0) {
 458                  g_strlcpy (te->stats.protection, si->stats.protection, MAX_PROTECT_LEN);
 459          }
 460          te->type[si->type]++;
 461          te->number_of_packets++;
 462   
 463          wlanstat_packet_details (te, si->type, &si->src, TRUE);  /* Register source */
 464          wlanstat_packet_details (te, si->type, &si->dst, FALSE); /* Register destination */
 465   
 466          return (1);
 467  }
Show more  




Change Warning 12313.30887 : Null Test After Dereference

Priority:
State:
Finding:
Owner:
Note: