mirror of
https://github.com/espressif/openthread.git
synced 2026-11-11 08:51:13 +00:00
Fix MAC security header processing and validation. (#936)
This commit is contained in:
@@ -204,9 +204,10 @@ ThreadError Frame::ValidatePsdu(void)
|
||||
// Security Header
|
||||
if (fcf & Frame::kFcfSecurityEnabled)
|
||||
{
|
||||
VerifyOrExit(offset <= GetPsduLength(),);
|
||||
uint8_t secControl = GetPsdu()[offset];
|
||||
|
||||
offset += kSecurityControlSize + kFrameCounterSize;
|
||||
|
||||
switch (secControl & kKeyIdModeMask)
|
||||
{
|
||||
case kKeyIdMode0:
|
||||
@@ -974,10 +975,7 @@ uint8_t *Frame::GetPayload(void)
|
||||
{
|
||||
securityControl = *cur;
|
||||
|
||||
if (securityControl & kSecLevelMask)
|
||||
{
|
||||
cur += kSecurityControlSize + kFrameCounterSize;
|
||||
}
|
||||
cur += kSecurityControlSize + kFrameCounterSize;
|
||||
|
||||
switch (securityControl & kKeyIdModeMask)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user