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

`enterRaffle` function lacks empty address check

Summary

The enterRaffle function lacks an empty address check for the input argument newPlayers array. This means that the function allows empty addresses to be added as players in the raffle.

Vulnerability Details

The enterRaffle function does not include a check to ensure that the addresses in the newPlayers array are not empty (address(0)). This omission allows empty addresses to be included as players in the raffle.

Impact

The absence of an empty address check in the enterRaffle function can have several potential impacts:

  • It may lead to unexpected behavior or errors in the smart contract logic.

  • It can affect the fairness and integrity of the raffle, as empty addresses should not be considered as valid participants.

  • It could potentially allow malicious actors to exploit the contract by using empty addresses to manipulate the raffle results or disrupt its operation.

Tools Used

Manual

Recommendations

To address this vulnerability, it is recommended to add a check in the enterRaffle function to ensure that the addresses in the newPlayers array are not empty. This can be achieved by adding a require statement similar to the following:

Copy

require(players[i] != address(0), "Empty Address");

This check will verify that each address in the newPlayers array is not an empty address before allowing them to participate in the raffle. By implementing this check, the contract can maintain the integrity of the raffle and prevent potential issues caused by empty addresses.

Updates

Lead Judging Commences

hexbyte Auditor
over 1 year ago
patrickalphac Lead Judge
over 1 year ago
Hamiltonite Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Zero address checks

Support

FAQs

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