Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Valid

getActivePlayerIndex() returns ambigious results

Summary

getActivePlayerIndex() returns 0 in two different cases.

Vulnerability Details

In one case 0 is returned when the first player has the address equal to the function's argument. In another case 0 is returned when no elements are found.

Impact

Low. The usage of this method can lead to unexpected bugs where extra debugging is required. However, the function is not used anywhere in the contract.

Tools Used

Manual check.

Recommendations

It's better to start with players[] and rewrite the contract, so that the mapping is used instead of array. Mapping will help to resolve current and some other issues.

Updates

Lead Judging Commences

Hamiltonite Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

getActivePlayerIndex can say a player is both entered at slot 0 and inactive

Support

FAQs

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