b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] batctl: fix endianness when reading radiotap header
@ 2020-04-29 10:09 Marek Lindner
  0 siblings, 0 replies; only message in thread
From: Marek Lindner @ 2020-04-29 10:09 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Marek Lindner

All radiotap header fields are specified in little endian byte-order.
Header length conversion is necessary on some platforms.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
 tcpdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcpdump.c b/tcpdump.c
index 4b9e4f6..1beace1 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -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;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-29 10:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 10:09 [PATCH] batctl: fix endianness when reading radiotap header Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).