(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/libpcap.c) |
| |
| 745 | | | static int (wtap *wth, int *err, gchar **err_info, |
| 746 | | | struct pcaprec_ss990915_hdr *hdr) |
| 747 | | | { |
| 748 | | | int bytes_to_read, bytes_read; |
| 749 | | | |
| 750 | | | |
| 751 | | | errno = WTAP_ERR_CANT_READ; |
| 752 | | | switch (wth->file_type) { |
| 753 | | | |
| 754 | | | case WTAP_FILE_PCAP: |
| 755 | | | case WTAP_FILE_PCAP_AIX: |
| 756 | | | case WTAP_FILE_PCAP_NSEC: |
| 757 | | | bytes_to_read = sizeof (struct pcaprec_hdr); |
| 758 | | | break; |
| 759 | | | |
| 760 | | | case WTAP_FILE_PCAP_SS990417: |
| 761 | | | case WTAP_FILE_PCAP_SS991029: |
| 762 | | | bytes_to_read = sizeof (struct pcaprec_modified_hdr); |
| 763 | | | break; |
| 764 | | | |
| 765 | | | case WTAP_FILE_PCAP_SS990915: |
| 766 | | | bytes_to_read = sizeof (struct pcaprec_ss990915_hdr); |
| 767 | | | break; |
| 768 | | | |
| 769 | | | case WTAP_FILE_PCAP_NOKIA: |
| 770 | | | bytes_to_read = sizeof (struct pcaprec_nokia_hdr); |
| 771 | | | break; |
| 772 | | | |
| 773 | | | default: |
| 774 | | | g_assert_not_reached();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 775 | | | bytes_to_read = 0; |
Unreachable Data Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 776 | | | } |
| 777 | | | bytes_read = file_read(hdr, 1, bytes_to_read, wth->fh);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/file_wrappers.h |
| |
36 | #define file_read(buf, bsize, count, file) gzread((file),(buf),(unsigned)((count)*(bsize))) |
| |
|
| 778 | | | if (bytes_read != bytes_to_read) { |
| 779 | | | *err = file_error(wth->fh); |
| 780 | | | if (*err == 0 && bytes_read != 0) { |
| 781 | | | *err = WTAP_ERR_SHORT_READ; |
| 782 | | | } |
| 783 | | | return -1; |
| 784 | | | } |
| 785 | | | |
| 786 | | | (wth, &hdr->hdr); |
| 787 | | | |
| 788 | | | if (hdr->hdr.incl_len > WTAP_MAX_PACKET_SIZE) { |
| 789 | | | |
| 790 | | | |
| 791 | | | |
| 792 | | | |
| 793 | | | |
| 794 | | | |
| 795 | | | |
| 796 | | | |
| 797 | | | *err = WTAP_ERR_BAD_RECORD; |
| 798 | | | if (err_info != NULL) { |
| 799 | | | *err_info = g_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u", |
| 800 | | | hdr->hdr.incl_len, WTAP_MAX_PACKET_SIZE); |
| 801 | | | } |
| 802 | | | return -1; |
| 803 | | | } |
| 804 | | | |
| 805 | | | if (hdr->hdr.orig_len > WTAP_MAX_PACKET_SIZE) { |
| 806 | | | |
| 807 | | | |
| 808 | | | |
| 809 | | | |
| 810 | | | |
| 811 | | | |
| 812 | | | |
| 813 | | | |
| 814 | | | *err = WTAP_ERR_BAD_RECORD; |
| 815 | | | if (err_info != NULL) { |
| 816 | | | *err_info = g_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u", |
| 817 | | | hdr->hdr.orig_len, WTAP_MAX_PACKET_SIZE); |
| 818 | | | } |
| 819 | | | return -1; |
| 820 | | | } |
| 821 | | | |
| 822 | | | return bytes_read; |
| 823 | | | } |
| |