Bug fix: Information Element parsing
@@ -422,17 +422,27 @@ void ieee802154_retrieveHeader(OpenQueueEntry_t *msg,
// Record the position where we should start decrypting the ACK, if security is enabled
msg->l2_payload = &msg->payload[ieee802514_header->headerLength];
break;
- default:
- break;
+ default: // this is not a IE header or payload, reset the header length and return.
+ ieee802514_header->headerLength -= 2;
+ msg->l2_payload = &msg->payload[ieee802514_header->headerLength];
+ ieee802514_header->valid = TRUE;
+ return;
}
}
+ else{
+ ieee802514_header->headerLength -= 2;
+ ieee802514_header->valid = TRUE;
+ break;
+ }
if (ieee802514_header->headerLength == msg->length) {
// nothing left, no payloadIE, no payload, this is the end of packet!
ieee802514_header->valid = TRUE;
return;
}
- if (ieee802514_header->headerLength > msg->length) { return; } // no more to read!
+ if (ieee802514_header->headerLength > msg->length) {
+ return;
+ } // no more to read!
}
}
