Repository : ssh://git@diktynna/batctl
On branch : master
commit 440ae55a6ef96eb73ee628f9237915cf9fb26dee Author: Marek Lindner mareklindner@neomailbox.ch Date: Wed Apr 29 12:09:44 2020 +0200
batctl: fix endianness when reading radiotap header
All radiotap header fields are specified in little endian byte-order. Header length conversion is necessary on some platforms.
Fixes: c6fcdb6dc9a9 ("batctl: add radiotap wifi packet decapsulation support") Signed-off-by: Marek Lindner mareklindner@neomailbox.ch Signed-off-by: Sven Eckelmann sven@narfation.org
440ae55a6ef96eb73ee628f9237915cf9fb26dee tcpdump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tcpdump.c b/tcpdump.c index 4b9e4f6..db93681 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -15,6 +15,7 @@ #include <time.h> #include <sys/time.h> #include <arpa/inet.h> +#include <endian.h> #include <net/if.h> #include <net/if_arp.h> #include <netinet/in.h> @@ -1144,10 +1145,10 @@ static int monitor_header_length(unsigned char *packet_buff, ssize_t buff_len, i return -1;
radiotap_hdr = (struct radiotap_header*)packet_buff; - if (buff_len <= radiotap_hdr->it_len) + if (buff_len <= le16toh(radiotap_hdr->it_len)) return -1; else - return radiotap_hdr->it_len; + return le16toh(radiotap_hdr->it_len); }
return -1;