MyCut

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

Array Index Out of Bounds

Summary

https://github.com/Cyfrin/2024-08-MyCut/blob/main/src/ContestManager.sol

The fundContest function accesses the contests array using an index provided by the caller without validating that the index is within the bounds of the array. This can lead to accessing an invalid index, resulting in runtime errors or unexpected behavior.

Pot pot = Pot(contests[index]);

Vulnerability Details

The function directly uses the provided index to access the contests array, which can lead to out-of-bounds access if the index is invalid.

Impact

An invalid index could cause the function to attempt accessing non-existent entries in the contests array, potentially leading to runtime errors or incorrect contract operations.

Tools Used

Manual Review

Recommendations

Add a check to ensure that the index parameter is within the valid range of the contests array.

require(index < contests.length, "Invalid contest index");
Updates

Lead Judging Commences

equious Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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