NestedFactory.removeOperator code doesn't correspond to it's logic #220
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
Handle
hyh
Vulnerability details
Impact
Current implementation throws if first operator is to be deleted, i.e.
operators[0] == operator
, and doesn't throw when operator is not found, i.e. there is noi
such thatoperators[i] == operator
. This way an expected logic of throwing whenever operator isn't found in current list and deleting the one found otherwise doesn't take place.This way
operators[0]
cannot be deletedoperators
list, an array bounds check violation will happenProof of Concept
NestedFactory.removeOperator code:
https://github.com/code-423n4/2021-11-nested/blob/main/contracts/NestedFactory.sol#L79
Recommended Mitigation Steps
Function code needs to be updated, for example:
Now:
To be:
The text was updated successfully, but these errors were encountered: