Skip to contentSkip to conversation

batctl: fix endianness when reading radiotap header

PATCH New Marek Lindner 1 participant 1 message Apr 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tcpdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tcpdump.c +2 -2
index 4b9e4f6..1beace1 100644
@@ -1144,10 +1144,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;
Signature · 1 line
2.25.1