First Flight #21: KittyFi

First Flight #21
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

KittyCoin::constructor Missing checks for address(0) when assigning values to address state variables, can lead to loss of assets in the protocol

Summary

The issue of "missing checks for address(0)" in smart contracts refers to the lack of validation to ensure that an address being assigned or used is not the zero address (0x0000000000000000000000000000000000000000). The zero address is a special address in Ethereum that often indicates an uninitialized state or serves as a null value for addresses.

Vulnerability Details

constructor(address _pool) ERC20("Kitty Token", "MEOWDY") {
@> pool = _pool;
}
constructor(address _pool) ERC20("Kitty Token", "MEOWDY") {
+ require(_pool != address(0), "Invalid address: zero address");
pool = _pool;
}

Impact

can lead to Loss of Assets in the protocol

Tools Used

manual review

Recommendations

Add require statement in the constructor to check for address zero

constructor(address _pool) ERC20("Kitty Token", "MEOWDY") {
+ require(_pool != address(0), "invalid address: zero address");
pool = _pool;
}
Updates

Lead Judging Commences

shikhar229169 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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