diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-06-02 19:06:05 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-06-02 19:06:05 +0000 |
commit | 7d5afce08f1e59a1c3bf448e968d4b2ae2224208 (patch) | |
tree | 333cd5680a6cd05dc7f23e570cafdebae6a31518 | |
parent | 75af067043f15f47ccd731af8e0517e4c0bc44a7 (diff) |
When doing a seek-and-read, don't check the packet size, as we don't
have it (we have the size with the pseudo-header length already
removed); we've already read the packet, and thus have already checked
it. Fixes bug 3501.
svn path=/trunk/; revision=28607
-rw-r--r-- | wiretap/libpcap.c | 4 | ||||
-rw-r--r-- | wiretap/pcap-common.c | 28 | ||||
-rw-r--r-- | wiretap/pcap-common.h | 4 |
3 files changed, 20 insertions, 16 deletions
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 9668fd104f..beee98f4fd 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -637,7 +637,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, *data_offset = wth->data_offset; phdr_len = pcap_process_pseudo_header(wth, wth->fh, packet_size, - &wth->phdr, &wth->pseudo_header, err, err_info); + TRUE, &wth->phdr, &wth->pseudo_header, err, err_info); if (phdr_len < 0) return FALSE; /* error */ @@ -705,7 +705,7 @@ libpcap_seek_read(wtap *wth, gint64 seek_off, return FALSE; phdr_len = pcap_process_pseudo_header(wth, wth->random_fh, length, - NULL, pseudo_header, err, err_info); + FALSE, NULL, pseudo_header, err, err_info); if (phdr_len < 0) return FALSE; /* error */ diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index 03cb2780c3..e096fc9f36 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -1116,8 +1116,8 @@ pcap_read_i2c_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, i int pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, - struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header, - int *err, gchar **err_info) + gboolean check_packet_size, struct wtap_pkthdr *phdr, + union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info) { int phdr_len = 0; guint size; @@ -1129,7 +1129,7 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, /* * Nokia IPSO ATM. */ - if (packet_size < NOKIAATM_LEN) { + if (check_packet_size && packet_size < NOKIAATM_LEN) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1148,7 +1148,7 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, /* * SunATM. */ - if (packet_size < SUNATM_LEN) { + if (check_packet_size && packet_size < SUNATM_LEN) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1189,7 +1189,7 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_IRDA: - if (packet_size < IRDA_SLL_LEN) { + if (check_packet_size && packet_size < IRDA_SLL_LEN) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1207,7 +1207,7 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_MTP2_WITH_PHDR: - if (packet_size < MTP2_HDR_LEN) { + if (check_packet_size && packet_size < MTP2_HDR_LEN) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1225,7 +1225,7 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_LINUX_LAPD: - if (packet_size < LAPD_SLL_LEN) { + if (check_packet_size && packet_size < LAPD_SLL_LEN) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1243,7 +1243,7 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_SITA: - if (packet_size < SITA_HDR_LEN) { + if (check_packet_size && packet_size < SITA_HDR_LEN) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1262,7 +1262,8 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, case WTAP_ENCAP_USB_LINUX: case WTAP_ENCAP_USB_LINUX_MMAPPED: - if (packet_size < sizeof (struct linux_usb_phdr)) { + if (check_packet_size && + packet_size < sizeof (struct linux_usb_phdr)) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1285,7 +1286,8 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR: - if (packet_size < sizeof (struct libpcap_bt_phdr)) { + if (check_packet_size && + packet_size < sizeof (struct libpcap_bt_phdr)) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1303,7 +1305,8 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_ERF: - if (packet_size < sizeof(struct erf_phdr) ) { + if (check_packet_size && + packet_size < sizeof(struct erf_phdr) ) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. @@ -1336,7 +1339,8 @@ pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, break; case WTAP_ENCAP_I2C: - if (packet_size < sizeof (struct i2c_file_hdr)) { + if (check_packet_size && + packet_size < sizeof (struct i2c_file_hdr)) { /* * Uh-oh, the packet isn't big enough to even * have a pseudo-header. diff --git a/wiretap/pcap-common.h b/wiretap/pcap-common.h index a058779454..a0a7da91d9 100644 --- a/wiretap/pcap-common.h +++ b/wiretap/pcap-common.h @@ -27,8 +27,8 @@ extern int wtap_wtap_encap_to_pcap_encap(int encap); extern int pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size, - struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header, - int *err, gchar **err_info); + gboolean check_packet_size, struct wtap_pkthdr *phdr, + union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); extern int pcap_get_phdr_size(int encap, const union wtap_pseudo_header *pseudo_header); |