Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at rtp_analysis.c:703

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

rtp_packet_save_payload

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/rtp_analysis.c)expand/collapse
Show more  
 638  static int rtp_packet_save_payload(tap_rtp_save_info_t *saveinfo,
 639                                     tap_rtp_stat_t *statinfo,
 640                                     packet_info *pinfo,
 641                                     const struct _rtp_info *rtpinfo)
 642  {
 643          guint i;
 644          const guint8 *data;
 645          guint8 tmp;
 646          size_t nchars;
 647   
 648          /*  is this the first packet we got in this direction? */
 649          if (statinfo->flags & STAT_FLAG_FIRST) {
 650                  if (saveinfo->fp == NULL) {
 651                          saveinfo->saved = FALSE;
 652                          saveinfo->error_type = TAP_RTP_FILE_OPEN_ERROR;
 653                  }
 654                  else 
 655                          saveinfo->saved = TRUE;
 656          }
 657   
 658          /* save the voice information */
 659          /* if there was already an error, we quit */
 660          if (saveinfo->saved == FALSE)
 661                  return 0;
 662   
 663          /* if the captured length and packet length aren't equal, we quit
 664          * if also the RTP dissector thinks there is some information missing */
 665          if ((pinfo->fd->pkt_len != pinfo->fd->cap_len) &&
 666              (!rtpinfo->info_all_data_present)) {
 667                  saveinfo->saved = FALSE;
 668                  saveinfo->error_type = TAP_RTP_WRONG_LENGTH;
 669                  return 0;
 670          }
 671   
 672          /* if padding bit is set, but the padding count is bigger
 673          * then the whole RTP data - error with padding count */
 674          if ( (rtpinfo->info_padding_set != FALSE) &&
 675                  (rtpinfo->info_padding_count > rtpinfo->info_payload_len) ) {
 676                  saveinfo->saved = FALSE;
 677                  saveinfo->error_type = TAP_RTP_PADDING_ERROR;
 678                  return 0;
 679          }
 680   
 681          /* do we need to insert some silence? */
 682          if ((rtpinfo->info_marker_set) &&
 683                  !(statinfo->flags & STAT_FLAG_FIRST) &&
 684                  !(statinfo->flags & STAT_FLAG_WRONG_TIMESTAMP) &&
 685                  (statinfo->delta_timestamp > (rtpinfo->info_payload_len - rtpinfo->info_padding_count)) )  {
 686                  /* the amount of silence should be the difference between 
 687                  * the last timestamp and the current one minus x 
 688                  * x should equal the amount of information in the last frame 
 689                  * XXX not done yet */
 690                  for(i=0; i < (statinfo->delta_timestamp - rtpinfo->info_payload_len -
 691                          rtpinfo->info_padding_count) && i < MAX_SILENCE_TICKS; i++) {
 692                          switch (statinfo->reg_pt) {
 693                          case PT_PCMU:
 694                                  tmp = SILENCE_PCMU;
 695                                  break;
 696                          case PT_PCMA:
 697                                  tmp = SILENCE_PCMA;
 698                                  break;
 699                          default:
 700                                  tmp = 0;
 701                                  break;
 702                          }
 703                          nchars=fwrite(&tmp, 1, 1, saveinfo->fp);
 704                          saveinfo->count++;
 705                  }
 706                  fflush(saveinfo->fp);
 707          }
 708   
 709   
 710          if (rtpinfo->info_payload_type == PT_CN 
 711                  || rtpinfo->info_payload_type == PT_CN_OLD) {
 712          }
 713          /*all other payloads*/
 714          else {
 715                  if (!rtpinfo->info_all_data_present) {
 716                          /* Not all the data was captured. */
 717                          saveinfo->saved = FALSE;
 718                          saveinfo->error_type = TAP_RTP_SHORT_FRAME;
 719                          return 0;
 720                  }
 721   
 722                  /* we put the pointer at the beginning of the RTP
 723                  * payload, that is, at the beginning of the RTP data 
 724                  * plus the offset of the payload from the beginning 
 725                  * of the RTP data */
 726                  data = rtpinfo->info_data + rtpinfo->info_payload_offset;
 727                  nchars=fwrite(data, sizeof(unsigned char), (rtpinfo->info_payload_len - rtpinfo->info_padding_count), saveinfo->fp);
 728                  saveinfo->count+=(rtpinfo->info_payload_len - rtpinfo->info_padding_count);
 729   
 730                  fflush(saveinfo->fp);
 731                  saveinfo->saved = TRUE;
 732                  return 0;
 733          }
 734   
 735          return 0;
 736  }
Show more  




Change Warning 5511.35788 : Ignored Return Value

Because they are very similar, this warning shares annotations with warning 5511.35789.

Priority:
State:
Finding:
Owner:
Note: