[router-table] validate router id before allocating router (#2710)

Credit to OSS-Fuzz.
This commit is contained in:
Jonathan Hui
2018-05-15 13:03:45 -07:00
committed by GitHub
parent f854cce1fb
commit 5659668aca
+1 -1
View File
@@ -241,7 +241,7 @@ Router *RouterTable::Allocate(uint8_t aRouterId)
{
Router *rval = NULL;
VerifyOrExit(!IsAllocated(aRouterId) && mRouterIdReuseDelay[aRouterId] == 0);
VerifyOrExit(aRouterId <= Mle::kMaxRouterId && !IsAllocated(aRouterId) && mRouterIdReuseDelay[aRouterId] == 0);
mAllocatedRouterIds[aRouterId / 8] |= 1 << (aRouterId % 8);
UpdateAllocation();