From 45fd47b6ec7cc8067df0112068b5d39577b63ad7 Mon Sep 17 00:00:00 2001 From: Anton Ottosson Date: Tue, 13 Jul 2021 02:58:23 +0200 Subject: [PATCH] Small fix to last commit If we cannot determine the length of the mac frame body, we should probably not attempt to parse it. --- lib/parse_mac.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/parse_mac.cc b/lib/parse_mac.cc index 707cf8d..b6c49ea 100644 --- a/lib/parse_mac.cc +++ b/lib/parse_mac.cc @@ -101,13 +101,13 @@ void parse(pmt::pmt_t pdu) { char *frame = (char*)pmt::blob_data(d_msg); - int body_start; + int body_start = frame_len; if((((h->frame_control) >> 2) & 63) == 2) { body_start = 24; // DATA } else if((((h->frame_control) >> 2) & 63) == 34) { body_start = 26; // QoS Data - } else return; + } int body_len = frame_len - body_start;