Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at voip_calls.c:944

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

SIPcalls_packet

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/voip_calls.c)expand/collapse
Show more  
 871  SIPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *SIPinfo)
 872  {
 873          voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
 874          /* we just take note of the ISUP data here; when we receive the MTP3 part everything will
 875             be compared with existing calls */
 876   
 877          voip_calls_info_t *tmp_listinfo;
 878          voip_calls_info_t *callsinfo = NULL;
 879          sip_calls_info_t *tmp_sipinfo = NULL;
 880          GList *list;
 881          address tmp_src, tmp_dst;
 882          gchar *frame_label = NULL;
 883          gchar *comment = NULL;
 884   
 885          const sip_info_value_t *pi = SIPinfo;
 886   
 887          /* do not consider packets without call_id */
 888          if (pi->tap_call_id ==NULL){
 889                  return 0;
 890          }
 891   
 892          /* check whether we already have a call with these parameters in the list */
 893          list = g_list_first(tapinfo->callsinfo_list);
 894          while (list)
 895          {
 896                  tmp_listinfo=list->data;
 897                  if (tmp_listinfo->protocol == VOIP_SIP){
 898                          tmp_sipinfo = tmp_listinfo->prot_info;
 899                          if (strcmp(tmp_sipinfo->call_identifier,pi->tap_call_id)==0){
 900                                  callsinfo = (voip_calls_info_t*)(list->data);
 901                                  break;
 902                          }
 903                  }
 904                  list = g_list_next (list);
 905          }
 906   
 907          /* not in the list? then create a new entry if the message is INVITE -i.e. if this session is a call*/
 908          if ((callsinfo==NULL) &&(pi->request_method!=NULL)){
 909                  if (strcmp(pi->request_method,"INVITE")==0){
 910                          callsinfo = g_malloc0(sizeof(voip_calls_info_t));
 911                          callsinfo->call_active_state = VOIP_ACTIVE;
 912                          callsinfo->call_state = VOIP_CALL_SETUP;
 913                          callsinfo->from_identity=g_strdup(pi->tap_from_addr);
 914                          callsinfo->to_identity=g_strdup(pi->tap_to_addr);
 915                          COPY_ADDRESS(&(callsinfo->initial_speaker),&(pinfo->src));
 916                          callsinfo->first_frame_num=pinfo->fd->num;
 917                          callsinfo->selected=FALSE;
 918                          callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
 919                          callsinfo->start_usec=pinfo->fd->rel_ts.nsecs/1000;
 920                          callsinfo->protocol=VOIP_SIP;
 921                          callsinfo->prot_info=g_malloc(sizeof(sip_calls_info_t));
 922                          callsinfo->free_prot_info = free_sip_info;
 923                          tmp_sipinfo = callsinfo->prot_info;
 924                          tmp_sipinfo->call_identifier = g_strdup(pi->tap_call_id);
 925                          tmp_sipinfo->sip_state = SIP_INVITE_SENT;
 926                          tmp_sipinfo->invite_cseq = pi->tap_cseq_number;
 927                          callsinfo->npackets = 0;
 928                          callsinfo->call_num = tapinfo->ncalls++;
 929                          tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
 930                  }
 931          }
 932   
 933          if (callsinfo!=NULL){
 934   
 935                  /* let's analyze the call state */
 936   
 937                  COPY_ADDRESS(&(tmp_src), &(pinfo->src));
 938                  COPY_ADDRESS(&(tmp_dst), &(pinfo->dst));
 939   
 940                  if (pi->request_method == NULL){
 941                          frame_label = g_strdup_printf("%u %s", pi->response_code, pi->reason_phrase );
 942                          comment = g_strdup("SIP Status");
 943   
 944                          if ((tmp_sipinfo && pi->tap_cseq_number == tmp_sipinfo->invite_cseq)&&(ADDRESSES_EQUAL(&tmp_dst,&(callsinfo->initial_speaker)))){
 945                                  if ((pi->response_code > 199) && (pi->response_code<300) && (tmp_sipinfo->sip_state == SIP_INVITE_SENT)){
 946                                          tmp_sipinfo->sip_state = SIP_200_REC;
 947                                  }
 948                                  else if ((pi->response_code>299)&&(tmp_sipinfo->sip_state == SIP_INVITE_SENT)){
 949                                          callsinfo->call_state = VOIP_REJECTED;
 950                                          tapinfo->rejected_calls++;
 951                                  }
 952                          }
 953   
 954                  }
 955                  else{
 956                          frame_label = g_strdup(pi->request_method);
 957   
 958                          if ((strcmp(pi->request_method,"INVITE")==0)&&(ADDRESSES_EQUAL(&tmp_src,&(callsinfo->initial_speaker)))){
 959                                  tmp_sipinfo->invite_cseq = pi->tap_cseq_number;
 960                                  callsinfo->call_state = VOIP_CALL_SETUP;
 961                                  comment = g_strdup_printf("SIP From: %s To:%s", callsinfo->from_identity, callsinfo->to_identity);
 962                          }
 963                          else if ((strcmp(pi->request_method,"ACK")==0)&&(pi->tap_cseq_number == tmp_sipinfo->invite_cseq)
 964                                  &&(ADDRESSES_EQUAL(&tmp_src,&(callsinfo->initial_speaker)))&&(tmp_sipinfo->sip_state==SIP_200_REC)
 965                                  &&(callsinfo->call_state == VOIP_CALL_SETUP)){
 966                                  callsinfo->call_state = VOIP_IN_CALL;
 967                                  comment = g_strdup("SIP Request");
 968                          }
 969                          else if (strcmp(pi->request_method,"BYE")==0){
 970                                  callsinfo->call_state = VOIP_COMPLETED;
 971                                  tapinfo->completed_calls++;
 972                                  comment = g_strdup("SIP Request");
 973                          }
 974                          else if ((strcmp(pi->request_method,"CANCEL")==0)&&(pi->tap_cseq_number == tmp_sipinfo->invite_cseq)
 975                                  &&(ADDRESSES_EQUAL(&tmp_src,&(callsinfo->initial_speaker)))&&(callsinfo->call_state==VOIP_CALL_SETUP)){
 976                                  callsinfo->call_state = VOIP_CANCELLED;
 977                                  tmp_sipinfo->sip_state = SIP_CANCEL_SENT;
 978                                  comment = g_strdup("SIP Request");
 979                          } else {
 980                                  comment = g_strdup("SIP Request");
 981                          }
 982                  }
 983   
 984                  callsinfo->stop_sec=(gint32) (pinfo->fd->rel_ts.secs);
 985                  callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs/1000;
 986                  callsinfo->last_frame_num=pinfo->fd->num;
 987                  ++(callsinfo->npackets);
 988                  /* increment the packets counter of all calls */
 989                  ++(tapinfo->npackets);
 990   
 991                  /* add to the graph */
 992                  add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
 993                  g_free(comment);
 994                  g_free(frame_label);
 995                  g_free((void *)tmp_src.data);
 996                  g_free((void *)tmp_dst.data);
 997   
 998                  /* add SDP info if apply */
 999                  if ( (sdp_summary != NULL) && (sdp_frame_num == pinfo->fd->num) ){
 1000                                  append_to_frame_graph(tapinfo, pinfo->fd->num, sdp_summary, NULL);
 1001                                  g_free(sdp_summary);
 1002                                  sdp_summary = NULL;
 1003                  }
 1004          }
 1005   
 1006          tapinfo->redraw = TRUE;
 1007   
 1008          return 1;  /* refresh output */
 1009  }
Show more  




Change Warning 4297.29876 : Null Test After Dereference

Priority:
State:
Finding:
Owner:
Note: