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

L-8: entryRaffle function should check for zeroAddress

Summary

LOW-8: The enterRaffle function shall check for zero-address to prevent apparently invalid input

Vulnerability Details

The entryRaffle function currently does not do a check whether there is a zero-address in the input array.

Impact

Potentially making the selectWinner function draw an invalid address, impact on user experience, decreasing the value of the contract and raffle as such

Tools Used

Static analysis

Recommendations

Adding an "if" statement to the for-loop adding players to the players array.

function enterRaffle(address[] memory newPlayers) public payable {
[...]

for (uint256 i = 0; i < newPlayers.length; i++) {
    if (newPlayers[i] == address(0) {
        revert("PuppyRaffle: Zero-address cannot participate in the raffle");
    }
    players.push(newPlayers[i]);
}

[...]

}

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Zero address checks

Support

FAQs

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

Give us feedback!