mirror of
https://github.com/espressif/openthread.git
synced 2026-09-07 01:30:11 +00:00
[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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user