Ethereal-dev: [ethereal-dev] Another patch to apply for the Nokia tcpdump problem
The patch I sent out causes Ethereal to dump core if asked to read a
libpcap capture file with no packets in it; apply this patch atop that
one, and that should fix the problem.
Index: libpcap.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/libpcap.c,v
retrieving revision 1.41
diff -c -r1.41 libpcap.c
*** libpcap.c 2000/09/15 07:52:42 1.41
--- libpcap.c 2000/09/17 07:45:50
***************
*** 572,582 ****
* Attempt to read the first record's header.
*/
if (libpcap_read_header(wth, err, &first_rec_hdr, TRUE) == -1) {
! if (*err == WTAP_ERR_SHORT_READ) {
/*
! * Short read - assume the file is in this format.
* When our client tries to read the first packet
! * they will presumably get the same short read.
*/
return THIS_FORMAT;
}
--- 572,584 ----
* Attempt to read the first record's header.
*/
if (libpcap_read_header(wth, err, &first_rec_hdr, TRUE) == -1) {
! if (*err == 0 || *err == WTAP_ERR_SHORT_READ) {
/*
! * EOF or short read - assume the file is in this
! * format.
* When our client tries to read the first packet
! * they will presumably get the same EOF or short
! * read.
*/
return THIS_FORMAT;
}
***************
*** 608,618 ****
* Now attempt to read the second record's header.
*/
if (libpcap_read_header(wth, err, &second_rec_hdr, TRUE) == -1) {
! if (*err == WTAP_ERR_SHORT_READ) {
/*
! * Short read - assume the file is in this format.
* When our client tries to read the second packet
! * they will presumably get the same short read.
*/
return THIS_FORMAT;
}
--- 610,622 ----
* Now attempt to read the second record's header.
*/
if (libpcap_read_header(wth, err, &second_rec_hdr, TRUE) == -1) {
! if (*err == 0 || *err == WTAP_ERR_SHORT_READ) {
/*
! * EOF or short read - assume the file is in this
! * format.
* When our client tries to read the second packet
! * they will presumably get the same EOF or short
! * read.
*/
return THIS_FORMAT;
}