(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/rtp_analysis.c) |
| |
| 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 | | | |
| 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 | | | |
| 659 | | | |
| 660 | | | if (saveinfo->saved == FALSE) |
| 661 | | | return 0; |
| 662 | | | |
| 663 | | | |
| 664 | | | |
| 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 | | | |
| 673 | | | |
| 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 | | | |
| 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 | | | |
| 687 | | | |
| 688 | | | |
| 689 | | | |
| 690 | | | for(i=0; i < (statinfo->delta_timestamp - rtpinfo->info_payload_len - |
| 691 | | | rtpinfo->info_padding_count) && i < MAX_SILENCE_TICKS; i++) { |
Event 2:
Continuing from loop body. Leaving loop. i < statinfo->delta_timestamp - rtpinfo->info_payload_len - rtpinfo->info_padding_count evaluates to false.
hide
|
|
| 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); |
Ignored Return Value
The return value of fwrite() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- CodeSonar is configured to enforce Ignored Return Value checks for fwrite(). (To change the set of enforced Ignored Return Value checks, use configuration file parameters RETURN_CHECKER_CHECKED_FUNCS and RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 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) {
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/rtp_pt.h |
| |
56 | #define PT_CN_OLD 19 /* Payload type reserved (old version Comfort Noise) */ |
| |
|
| 712 | | | } |
| 713 | | | |
| 714 | | | else { |
| 715 | | | if (!rtpinfo->info_all_data_present) { |
Event 4:
Skipping " if". rtpinfo->info_all_data_present evaluates to true.
hide
|
|
| 716 | | | |
| 717 | | | saveinfo->saved = FALSE; |
| 718 | | | saveinfo->error_type = TAP_RTP_SHORT_FRAME; |
| 719 | | | return 0; |
| 720 | | | } |
| 721 | | | |
| 722 | | | |
| 723 | | | |
| 724 | | | |
| 725 | | | |
| 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; |
Event 5:
!0 evaluates to true.
hide
|
|
| 732 | | | return 0; |
| 733 | | | } |
| 734 | | | |
| 735 | | | return 0; |
| 736 | | | } |
| |