Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at packet-sip.c:3354

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

sip_is_packet_resend

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-sip.c)expand/collapse
Show more  
 3264  guint sip_is_packet_resend(packet_info *pinfo,
 3265                          gchar *cseq_method,
 3266                          gchar *call_id,
 3267                          guchar cseq_number_set,
 3268                          guint32 cseq_number, line_type_t line_type)
 3269  {
 3270          guint32 cseq_to_compare = 0;
 3271          sip_hash_key   key;
 3272          sip_hash_key   *p_key = 0;
 3273          sip_hash_value *p_val = 0;
 3274          sip_frame_result_value *sip_frame_result = NULL;
 3275          guint result = 0;
 3276   
 3277          /* Only consider retransmission of UDP packets */
 3278          if (pinfo->ptype != PT_UDP)
 3279          {
 3280                  return 0;
 3281          }
 3282   
 3283          /* Don't consider packets that appear to be resent only because 
 3284             they are e.g. returned in ICMP unreachable messages. */
 3285          if (pinfo->in_error_pkt)
 3286          {
 3287                  return 0;
 3288          }
 3289   
 3290          /* A broken packet may have no cseq number set. Don't consider it as 
 3291             a resend */
 3292          if (!cseq_number_set)
 3293          {
 3294                  return 0;
 3295          }
 3296   
 3297          /* Return any answer stored from previous dissection */
 3298          if (pinfo->fd->flags.visited)
 3299          {
 3300                  sip_frame_result = (sip_frame_result_value*)p_get_proto_data(pinfo->fd, proto_sip);
 3301                  if (sip_frame_result != NULL)
 3302                  {
 3303                          return sip_frame_result->original_frame_num;
 3304                  }
 3305                  else 
 3306                  {
 3307                          return 0;
 3308                  }
 3309          }
 3310   
 3311          /* No packet entry found, consult global hash table */
 3312   
 3313          /* Prepare the key */
 3314          g_strlcpy(key.call_id, call_id, MAX_CALL_ID_SIZE);
 3315   
 3316          /*  We're only using these addresses locally (for the hash lookup) so 
 3317           *  there is no need to make a (g_malloc'd) copy of them.
 3318           */
 3319          SET_ADDRESS(&key.dest_address, pinfo->net_dst.type, pinfo->net_dst.len,
 3320                      pinfo->net_dst.data);
 3321          SET_ADDRESS(&key.source_address, pinfo->net_src.type,
 3322                      pinfo->net_src.len, pinfo->net_src.data);
 3323          key.dest_port = pinfo->destport;
 3324          key.source_port = pinfo->srcport;
 3325   
 3326          /* Do the lookup */
 3327          p_val = (sip_hash_value*)g_hash_table_lookup(sip_hash, &key);
 3328   
 3329          if (p_val)
 3330          {
 3331                  /* Table entry found, we'll use its value for comparison */
 3332                  cseq_to_compare = p_val->cseq;
 3333   
 3334                  /* First time through, must update value with current details if 
 3335                      cseq number has changed */
 3336                  if (cseq_number != p_val->cseq)
 3337                  {
 3338                          p_val->cseq = cseq_number;
 3339                          g_strlcpy(p_val->method, cseq_method, MAX_CSEQ_METHOD_SIZE);
 3340                          p_val->transaction_state = nothing_seen;
 3341                          p_val->frame_number = 0;
 3342                          if (line_type == REQUEST_LINE)
 3343                          {
 3344                                  p_val->request_time = pinfo->fd->abs_ts;
 3345                          }
 3346                  }
 3347          }
 3348          else 
 3349          {
 3350                  /* Need to create a new table entry */
 3351   
 3352                  /* Allocate a new key and value */
 3353                  p_key = se_alloc(sizeof(sip_hash_key));
 3354                  p_val = se_alloc(sizeof(sip_hash_value));
 3355   
 3356                  /* Just give up if allocations failed */
 3357                  if (!p_key || !p_val)
 3358                  {
 3359                          return 0;
 3360                  }
 3361   
 3362                  /* Fill in key and value details */
 3363                  g_snprintf(p_key->call_id, MAX_CALL_ID_SIZE, "%s", call_id);
 3364                  SE_COPY_ADDRESS(&(p_key->dest_address), &pinfo->net_dst);
 3365                  SE_COPY_ADDRESS(&(p_key->source_address), &pinfo->net_src);
 3366                  p_key->dest_port = pinfo->destport;
 3367                  p_key->source_port = pinfo->srcport;
 3368   
 3369                  p_val->cseq = cseq_number;
 3370                  g_strlcpy(p_val->method, cseq_method, MAX_CSEQ_METHOD_SIZE);
 3371                  p_val->transaction_state = nothing_seen;
 3372                  p_val->frame_number = 0;
 3373                  if (line_type == REQUEST_LINE)
 3374                  {
 3375                          p_val->request_time = pinfo->fd->abs_ts;
 3376                  }
 3377   
 3378                  /* Add entry */
 3379                  g_hash_table_insert(sip_hash, p_key, p_val);
 3380   
 3381                  /* Assume have seen no cseq yet */
 3382                  cseq_to_compare = 0;
 3383          }
 3384   
 3385   
 3386          /******************************************/
 3387          /* Is it a resend???                      */
 3388   
 3389          /* Does this look like a resent request (discount ACK, CANCEL, or a
 3390             different method from the original one) ? */
 3391   
 3392          if ((line_type == REQUEST_LINE) && (cseq_number == cseq_to_compare) &&
 3393              (p_val->transaction_state == request_seen) &&
 3394              (strcmp(cseq_method, p_val->method) == 0) &&
 3395              (strcmp(cseq_method, "ACK") != 0) &&
 3396              (strcmp(cseq_method, "CANCEL") != 0))
 3397          {
 3398                  result = p_val->frame_number;
 3399          }
 3400   
 3401          /* Does this look like a resent final response ? */
 3402          if ((line_type == STATUS_LINE) && (cseq_number == cseq_to_compare) &&
 3403              (p_val->transaction_state == final_response_seen) &&
 3404              (strcmp(cseq_method, p_val->method) == 0) &&
 3405              (stat_info->response_code >= 200) &&
 3406              (stat_info->response_code == p_val->response_code))
 3407          {
 3408                  result = p_val->frame_number;
 3409          }
 3410   
 3411          /* Update state for this entry */
 3412          p_val->cseq = cseq_number;
 3413   
 3414          switch (line_type)
 3415          {
 3416                  case REQUEST_LINE:
 3417                          p_val->transaction_state = request_seen;
 3418                          if (!result)
 3419                          {
 3420                                  /* This frame is the original request */
 3421                                  p_val->frame_number = pinfo->fd->num;
 3422                          }
 3423                          break;
 3424                  case STATUS_LINE:
 3425                          if (stat_info->response_code >= 200)
 3426                          {
 3427                                  p_val->response_code = stat_info->response_code;
 3428                                  p_val->transaction_state = final_response_seen;
 3429                                  if (!result)
 3430                                  {
 3431                                          /* This frame is the original response */
 3432                                          p_val->frame_number = pinfo->fd->num;
 3433                                  }
 3434                          }
 3435                          else 
 3436                          {
 3437                                  p_val->transaction_state = provisional_response_seen;
 3438                          }
 3439                          break;
 3440                  default:
 3441                          break;
 3442          }
 3443   
 3444          sip_frame_result = p_get_proto_data(pinfo->fd, proto_sip);
 3445          if (sip_frame_result == NULL)
 3446          {
 3447                  sip_frame_result = se_alloc(sizeof(sip_frame_result_value));
 3448          }
 3449   
 3450          /* Store return value with this packet */
 3451          sip_frame_result->original_frame_num = result;
 3452          p_add_proto_data(pinfo->fd, proto_sip, sip_frame_result);
 3453   
 3454          return result;
 3455  }
Show more  




Change Warning 5421.35643 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: