Get rid of unused flag argument.
We always tell pcap_process_pseudo_header() to check to make sure the pseudo-header isn't bigger than the captured data; no need for a flag argument to tell it to do so. Change-Id: I8310bb06a390a7f4a7a232ad140ae07955d52da1 Reviewed-on: https://code.wireshark.org/review/29833 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
4b9a4bcb74
commit
f9129721b2
|
@ -751,7 +751,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec,
|
||||||
}
|
}
|
||||||
|
|
||||||
phdr_len = pcap_process_pseudo_header(fh, wth->file_type_subtype,
|
phdr_len = pcap_process_pseudo_header(fh, wth->file_type_subtype,
|
||||||
wth->file_encap, packet_size, TRUE, rec, err, err_info);
|
wth->file_encap, packet_size, rec, err, err_info);
|
||||||
if (phdr_len < 0)
|
if (phdr_len < 0)
|
||||||
return FALSE; /* error */
|
return FALSE; /* error */
|
||||||
|
|
||||||
|
|
|
@ -1648,8 +1648,7 @@ pcap_read_i2c_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, i
|
||||||
|
|
||||||
int
|
int
|
||||||
pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
guint packet_size, gboolean check_packet_size,
|
guint packet_size, wtap_rec *rec, int *err, gchar **err_info)
|
||||||
wtap_rec *rec, int *err, gchar **err_info)
|
|
||||||
{
|
{
|
||||||
int phdr_len = 0;
|
int phdr_len = 0;
|
||||||
guint size;
|
guint size;
|
||||||
|
@ -1661,7 +1660,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
/*
|
/*
|
||||||
* Nokia IPSO ATM.
|
* Nokia IPSO ATM.
|
||||||
*/
|
*/
|
||||||
if (check_packet_size && packet_size < NOKIAATM_LEN) {
|
if (packet_size < NOKIAATM_LEN) {
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1680,7 +1679,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
/*
|
/*
|
||||||
* SunATM.
|
* SunATM.
|
||||||
*/
|
*/
|
||||||
if (check_packet_size && packet_size < SUNATM_LEN) {
|
if (packet_size < SUNATM_LEN) {
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1733,7 +1732,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_IRDA:
|
case WTAP_ENCAP_IRDA:
|
||||||
if (check_packet_size && packet_size < IRDA_SLL_LEN) {
|
if (packet_size < IRDA_SLL_LEN) {
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1751,7 +1750,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_MTP2_WITH_PHDR:
|
case WTAP_ENCAP_MTP2_WITH_PHDR:
|
||||||
if (check_packet_size && packet_size < MTP2_HDR_LEN) {
|
if (packet_size < MTP2_HDR_LEN) {
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1769,7 +1768,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_LINUX_LAPD:
|
case WTAP_ENCAP_LINUX_LAPD:
|
||||||
if (check_packet_size && packet_size < LAPD_SLL_LEN) {
|
if (packet_size < LAPD_SLL_LEN) {
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1787,7 +1786,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_SITA:
|
case WTAP_ENCAP_SITA:
|
||||||
if (check_packet_size && packet_size < SITA_HDR_LEN) {
|
if (packet_size < SITA_HDR_LEN) {
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1810,8 +1809,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
|
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
|
||||||
if (check_packet_size &&
|
if (packet_size < sizeof (struct libpcap_bt_phdr)) {
|
||||||
packet_size < sizeof (struct libpcap_bt_phdr)) {
|
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1829,8 +1827,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR:
|
case WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR:
|
||||||
if (check_packet_size &&
|
if (packet_size < sizeof (struct libpcap_bt_monitor_phdr)) {
|
||||||
packet_size < sizeof (struct libpcap_bt_monitor_phdr)) {
|
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1848,7 +1845,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_NFC_LLCP:
|
case WTAP_ENCAP_NFC_LLCP:
|
||||||
if (check_packet_size && packet_size < LLCP_HEADER_LEN) {
|
if (packet_size < LLCP_HEADER_LEN) {
|
||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = g_strdup("pcap: libpcap llcp file too short");
|
*err_info = g_strdup("pcap: libpcap llcp file too short");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1859,8 +1856,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_PPP_WITH_PHDR:
|
case WTAP_ENCAP_PPP_WITH_PHDR:
|
||||||
if (check_packet_size &&
|
if (packet_size < sizeof (struct libpcap_ppp_phdr)) {
|
||||||
packet_size < sizeof (struct libpcap_ppp_phdr)) {
|
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1878,8 +1874,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_ERF:
|
case WTAP_ENCAP_ERF:
|
||||||
if (check_packet_size &&
|
if (packet_size < sizeof(struct erf_phdr) ) {
|
||||||
packet_size < sizeof(struct erf_phdr) ) {
|
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
@ -1910,8 +1905,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
|
|
||||||
phdr_len += size;
|
phdr_len += size;
|
||||||
|
|
||||||
if (check_packet_size &&
|
if (packet_size < (guint)phdr_len) {
|
||||||
packet_size < (guint)phdr_len) {
|
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough for the pseudo-
|
* Uh-oh, the packet isn't big enough for the pseudo-
|
||||||
* header.
|
* header.
|
||||||
|
@ -1924,8 +1918,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WTAP_ENCAP_I2C:
|
case WTAP_ENCAP_I2C:
|
||||||
if (check_packet_size &&
|
if (packet_size < sizeof (struct i2c_file_hdr)) {
|
||||||
packet_size < sizeof (struct i2c_file_hdr)) {
|
|
||||||
/*
|
/*
|
||||||
* Uh-oh, the packet isn't big enough to even
|
* Uh-oh, the packet isn't big enough to even
|
||||||
* have a pseudo-header.
|
* have a pseudo-header.
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
extern guint wtap_max_snaplen_for_encap(int wtap_encap);
|
extern guint wtap_max_snaplen_for_encap(int wtap_encap);
|
||||||
|
|
||||||
extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||||
guint packet_size, gboolean check_packet_size,
|
guint packet_size, wtap_rec *rec, int *err, gchar **err_info);
|
||||||
wtap_rec *rec, int *err, gchar **err_info);
|
|
||||||
|
|
||||||
extern void pcap_read_post_process(int file_type, int wtap_encap,
|
extern void pcap_read_post_process(int file_type, int wtap_encap,
|
||||||
wtap_rec *rec, guint8 *pd, gboolean bytes_swapped, int fcs_len);
|
wtap_rec *rec, guint8 *pd, gboolean bytes_swapped, int fcs_len);
|
||||||
|
|
|
@ -1223,7 +1223,6 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
|
||||||
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
|
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
|
||||||
iface_info.wtap_encap,
|
iface_info.wtap_encap,
|
||||||
packet.cap_len,
|
packet.cap_len,
|
||||||
TRUE,
|
|
||||||
wblock->rec,
|
wblock->rec,
|
||||||
err,
|
err,
|
||||||
err_info);
|
err_info);
|
||||||
|
@ -1511,7 +1510,6 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
|
||||||
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
|
WTAP_FILE_TYPE_SUBTYPE_PCAPNG,
|
||||||
iface_info.wtap_encap,
|
iface_info.wtap_encap,
|
||||||
simple_packet.cap_len,
|
simple_packet.cap_len,
|
||||||
TRUE,
|
|
||||||
wblock->rec,
|
wblock->rec,
|
||||||
err,
|
err,
|
||||||
err_info);
|
err_info);
|
||||||
|
|
Loading…
Reference in New Issue