MyCut

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

Input Validation Error: player vs. reward length

Summary

When a new pot is created in ContestManager::createContest, the length of players and rewards can mismatch due to a missing array length check.

Vulnerability Details

When a pot is created in createContest, it can (accidentally) happen that the array length of players and rewards mismatch. Those arrays are expected to match but are not validated before use.

Impact

This can lead to out-of-bound errors, incorrect reward distribution or skipping/ignoring the rewards for players

Tools Used

Manual Review

Recommendations

Adding an array length validation, such as

function createContest(address[] memory players, uint256[] memory rewards, IERC20 token, uint256 totalRewards)
public
onlyOwner
returns (address)
{
// Create a new Pot contract
+ require(players.length==rewards.length, "Players and rewards length mismatch");
Pot pot = new Pot(players, rewards, token, totalRewards);
contests.push(address(pot));
contestToTotalRewards[address(pot)] = totalRewards;
return address(pot);
}
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.