Platform: Code4rena
Start Date: 11/11/2021
Pot Size: $50,000 USDC
Total HM: 9
Participants: 27
Period: 7 days
Judge: alcueca
Total Solo HM: 5
Id: 53
League: ETH
Rank: 25/27
Findings: 1
Award: $18.83
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: hyh
Also found by: MaCree, elprofesor, fatima_naz, gpersoon, gzeon, loop, palina, pauliax, pmerkleplant, xYrYuYx, ye0lde
gpersoon
The function removeOperator of NestedFactory.sol doesn't work as expected. If you try to remove the first operator then i will be 0 and the "require(i > 0, ..." will stop the execution.
If you try to remove a non existing operator then i will reach operators[i].length. I will be our of range of the array. Then all uses of operators[i] will fail.
function removeOperator(bytes32 operator) external override onlyOwner { uint256 i = 0; while (operators[i] != operator) { i++; } require(i > 0, "NestedFactory::removeOperator: Cant remove non-existent operator"); delete operators[i]; }
Change the code to:
uint256 i = 0; while ( i<operators.length && operators[i] != x) { i++; } require(i < operators.length, "NestedFactory::removeOperator: Cant remove non-existent operator"); delete operators[i];
#0 - maximebrugel
2021-11-17T13:04:24Z
Duplicated : #58
#1 - alcueca
2021-12-03T11:13:01Z
Using #220 instead