GivingThanks

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

Lack of check 0 address in the constructor

Summary

The constructor initializes the CharityRegistry, but there is no validation to check if the address is zero.

Vulnerability Details

Lack of validation of 0 address in the constructor during initialization of CharityRegistry.

constructor(address _registry) ERC721("DonationReceipt", "DRC") {
// @audit here should be validation of the 0 address.
registry = CharityRegistry(msg.sender);
owner = msg.sender;
tokenCounter = 0;
}

Impact

Initializing the CharityRegistry with a zero address disrupts protocol functionality. It is essential to validate the address during initialization to ensure the proper functioning of the protocol.

Tools Used

manual review

Recommendations

Please add 0 address validation in the constructor.

require(_registry != address(0), "Invalid registry address")

constructor(address _registry) ERC721("DonationReceipt", "DRC") {
// @audit here should be validation of the 0 address.
require(_registry != address(0), "Invalid registry address")
registry = CharityRegistry(msg.sender);
owner = msg.sender;
tokenCounter = 0;
}
Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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