Skip to content

Commit 74c2531

Browse files
authored
[mle] handle invalid leader mask in HandleAddressSolicitResponse (openthread#13063)
This commit resolves an issue in HandleAddressSolicitResponse where a malformed or invalid leader-supplied Router ID Mask omitting the leader ID could trigger an assertion. When a node receives an Address Solicit Response, it installs the new router ID mask. If the leader's router ID is missing from the mask, the Router entry for the leader is removed from the local router table. Subsequently, when the node tries to ensure it has a valid next hop and cost towards the leader, `mRouterTable.GetLeader()` returns `nullptr`, leading to an `OT_ASSERT(leader != nullptr)` failure or a null-pointer write when assertions are disabled. This is resolved by safely verifying that the leader's router ID is indeed present in the received router ID mask before applying the routing update, ensuring `GetLeader()` is guaranteed to find it.
1 parent 6954667 commit 74c2531

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/core/thread/mle_ftd.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,6 +3363,7 @@ void Mle::HandleAddressSolicitResponse(Coap::Msg *aMsg, Error aResult)
33633363

33643364
SuccessOrExit(Tlv::Find<ThreadRouterMaskTlv>(aMsg->mMessage, routerIdMask));
33653365
VerifyOrExit(routerIdMask.IsValid());
3366+
VerifyOrExit(routerIdMask.IsAllocated(GetLeaderId()));
33663367

33673368
SetAlternateRloc16(GetRloc16());
33683369

0 commit comments

Comments
 (0)