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

Sending NFT to zero address can cause the `selectWinner` function to revert.

Summary

Sending an nft to a zero address will revert the selectWinner function.

Vulnerability Details

In the current implementation of the contract, whenever a player is refunded the player address is replaced with a zero addresss. Now as the players array contains this zero address and if the selectWinner function selects this zero address as the winner then _safeMint(winner, tokenId); this line would cause a revert.

Impact

The selectWinner function would revert if the winner is a zero address.

Tools Used

VS code

Recommendations

Move the value of the last index to the refunded address refunded address to the last index and then use the pop method to remove the refunded address instead of setting it to a zero address.

Updates

Lead Judging Commences

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

zero address can win the raffle

Funds are locked to no one. If someone gets the refund issue, they also got this issue. IMPACT: High Likelihood: High

Support

FAQs

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