MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

Missing array lengths match check in Pot.sol Constructor

Summary

Deployer provided arrays in Pot.sol should be checked to be matching lengths in constructor to avoid problematic behaviour.

Vulnerability Details

constructor(address[] memory players, uint256[] memory rewards, IERC20 token, uint256 totalRewards) {
i_players = players;
i_rewards = rewards;
i_token = token;
i_totalRewards = totalRewards;
remainingRewards = totalRewards;
i_deployedAt = block.timestamp;
//@audit - need to check that sufficient rewards were provided. That totalRewards equals the sum of all rewards in rewards[]
// i_token.transfer(address(this), i_totalRewards);
for (uint256 i = 0; i < i_players.length; i++) {
playersToRewards[i_players[i]] = i_rewards[i];
}
}

Impact

Lack of array length matching check could result in players not being assigned rewards or rewards intended for a certain player actually being assigned to another.

Tools Used

Manual Review

Recommendations

Implement checks in the constructor to ensure that the different array lengths match each other.

Updates

Lead Judging Commences

equious Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.