[Listener] Check radiotap header length

From time to time, the length of the radiotap header (rtap_bytes in
read_packet()) is 65535. This is a quick & dirty fix to avoid segfaults,
but we should search for the reason why this value sometimes appears.
This commit is contained in:
Matteo Cypriani 2012-01-18 10:55:07 +01:00
parent 08a8626354
commit 7fc89a381c
1 changed files with 3 additions and 0 deletions

View File

@ -855,6 +855,9 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
memcpy(&rtap_bytes, &packet[2], sizeof(rtap_bytes)) ;
// Radiotap header is little-endian
rtap_bytes = le16toh(rtap_bytes) ;
// Check rtap_bytes for buggy values
if (rtap_bytes > 100)
return ;
// After the rtap header, there is the 802.11 header; the first byte
// is the first byte of the Frame Control (FC) field, which contains