Impact: Medium
Likelihood: Medium
It is possible to pass arrays address[] memory players and uint256[] memory rewards of different length as params to ContestManager::createContest(), where the lengths are never validated.
Later these arrays are passed to a Pot.sol constructor, where for each player from address[] memory players array a corresponding reward is assigned from a uint256[] memory rewards array and stored in a mapping mapping(address => uint256) private playersToRewards.
Here is ContestManager::createContest():
Here is Pot.sol constructor:
Likelihood:
The issue will occur when amount of members in players array is more than an amount of members in rewards array in params of ContestManager::createContest
Impact:
It will not be possible to create a Pot, the transaction will revert but gas for the previous actions in createContest() function and Pot.sol constructor will be vasted.
Please, add the following test test_revertsWhen_playersAndRewardsArraysLengthIsDifferent to TestMyCut.t.sol.
The amount of players is less than amount of rewards in arrays - players.length > rewards.length.
Check length of both arrays and revert if the lengths are not equal:
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.