[mesh-forwarder] update CheckReachablity() to handle malformed messages (#9976)

This commit ensures `MeshForwarder::CheckReachablity()` rejects frames
where `Ip6::Header::DecompressFrom(FrameData)` returns a parse error.
This prevents the processing of potentially malformed messages.
This commit is contained in:
Abtin Keshavarzian
2024-03-28 08:32:55 -07:00
committed by GitHub
parent 911f0d5a5c
commit 37144f078e
+8 -2
View File
@@ -627,10 +627,16 @@ Error MeshForwarder::CheckReachability(const FrameData &aFrameData, const Mac::A
error = ip6Headers.DecompressFrom(aFrameData, aMeshAddrs, GetInstance());
if (error == kErrorNotFound)
switch (error)
{
case kErrorNone:
break;
case kErrorNotFound:
// Frame may not contain an IPv6 header.
ExitNow(error = kErrorNone);
error = kErrorNone;
OT_FALL_THROUGH;
default:
ExitNow();
}
error = Get<Mle::MleRouter>().CheckReachability(aMeshAddrs.mDestination.GetShort(), ip6Headers.GetIp6Header());