Mystery Box

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

claimSingleReward Incorrect Index Check

Summary

The claimSingleReward function checks require(_index <= rewardsOwned[msg.sender].length, "Invalid index");, but the condition should be strictly less than (<), as array indices are zero-based and rewardsOwned[msg.sender].length is out of bounds.

Impact

The function should revert if the index is out of bounds.

Tools Used
manual

Recommendations

Change the <= to < to correctly handle the index bounds:

require(_index < rewardsOwned[msg.sender].length, "Invalid index");
Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!