mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 01:17:46 +00:00
[mpl] fix bug in comparing sequence numbers (#3588)
Fix serial number arithmetic due to value wrap.
This commit is contained in:
@@ -158,12 +158,14 @@ otError Mpl::UpdateSeedSet(uint16_t aSeedId, uint8_t aSequence)
|
||||
{
|
||||
// have existing entries for aSeedId
|
||||
|
||||
if (aSequence == mSeedSet[i].GetSequence())
|
||||
int8_t diff = static_cast<int8_t>(aSequence - mSeedSet[i].GetSequence());
|
||||
|
||||
if (diff == 0)
|
||||
{
|
||||
// already received, drop message
|
||||
ExitNow(error = OT_ERROR_DROP);
|
||||
}
|
||||
else if (insert == NULL && aSequence < mSeedSet[i].GetSequence())
|
||||
else if (insert == NULL && diff < 0)
|
||||
{
|
||||
// insert in order of sequence
|
||||
insert = &mSeedSet[i];
|
||||
|
||||
Reference in New Issue
Block a user