From 804ea411fc60a95138c1ad98fd437c4a8bb23a35 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Tue, 16 Apr 2013 13:45:30 -0300 Subject: [PATCH] Fixed bug in RadioTap when using FCS at the end. --- src/radiotap.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/radiotap.cpp b/src/radiotap.cpp index 60c6fbc..517479f 100644 --- a/src/radiotap.cpp +++ b/src/radiotap.cpp @@ -124,14 +124,15 @@ RadioTap::RadioTap(const uint8_t *buffer, uint32_t total_sz) read_field(buffer, radiotap_hdr_size, _channel); read_field(buffer, radiotap_hdr_size, _max_power); } - if((flags() & FCS) != 0) { - check_size(radiotap_hdr_size, sizeof(uint32_t)); - radiotap_hdr_size -= sizeof(uint32_t); - } - total_sz -= _radio.it_len; + total_sz -= Endian::le_to_host(_radio.it_len); buffer += radiotap_hdr_size; + if((flags() & FCS) != 0) { + check_size(total_sz, sizeof(uint32_t)); + total_sz -= sizeof(uint32_t); + } + if(total_sz) inner_pdu(Dot11::from_bytes(buffer, total_sz)); }