[riot-notifications] [RIOT-OS/RIOT] nrf802154: Validate frame length before dst filter (#11191)

Koen Zandberg notifications at github.com
Fri Apr 5 11:54:28 CEST 2019


bergzand commented on this pull request.



> @@ -131,6 +131,26 @@ static void _enable_tx(void)
     NRF_RADIO->TASKS_START = 1;
  }
 
+/**
+ * @brief basic ieee802.15.4 data frame validation
+ */
+static bool _data_frame_filter(void)
+{
+    size_t psdu_len = rxbuf[0];
+    if (psdu_len < IEEE802154_FCF_LEN) {
+        return false;
+    }
+    size_t expected_len = ieee802154_get_frame_hdr_len(&rxbuf[1]);
+    if (!expected_len) {

Agreed, I agree with your suggestion to compare with zero to increase readability. I'll also try to make the set of checks a bit more readable with some comments :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11191#discussion_r272518861
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190405/e7c46e10/attachment-0001.html>


More information about the notifications mailing list