From 10666f5c1ef69e50a3a250281c9484b2728e3e35 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 2 Jul 2018 10:44:28 -0500 Subject: [PATCH] [mac] ensure frame validation checks occur before reading FCF (#2845) Credit to OSS-Fuzz. --- src/core/mac/mac_frame.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/mac/mac_frame.cpp b/src/core/mac/mac_frame.cpp index f945e529b..7d30aa186 100644 --- a/src/core/mac/mac_frame.cpp +++ b/src/core/mac/mac_frame.cpp @@ -891,8 +891,7 @@ exit: uint8_t Frame::FindPayloadIndex(void) const { - uint16_t fcf = GetFrameControlField(); - uint8_t index = SkipSecurityHeaderIndex(); + uint8_t index = SkipSecurityHeaderIndex(); #if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC uint8_t *cur = NULL; uint8_t *footer = GetFooter(); @@ -929,7 +928,7 @@ uint8_t Frame::FindPayloadIndex(void) const #endif // Command ID - if ((fcf & kFcfFrameTypeMask) == kFcfFrameMacCmd) + if ((GetFrameControlField() & kFcfFrameTypeMask) == kFcfFrameMacCmd) { index += kCommandIdSize; }