Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

[L-6] mintSnowman does not check for 0 amount

[L-6] Snowman::mintSnowman does not check for 0 amount

Description

  • The mintSnowman() takes in parameter amount for determining the number of NFTs to mint

  • The function does not check for 0 amount which basically does nothing

function mintSnowman(address receiver, uint256 amount) external {
for (uint256 i = 0; i < amount; i++) {
_safeMint(receiver, s_TokenCounter);
emit SnowmanMinted(receiver, s_TokenCounter);
s_TokenCounter++;
}
}

Risk

Likelihood:

  • Whenever mintSnowman() is called with amount = 0

Impact:

  • Unnecessary function execution

Proof of Concept

Add the following test case to the test suite of Snowman

function test_zeroAmount() public {
nft.mintSnowman(alice, 0);
}

Recommended Mitigation

+ assert(amount != 0);
Updates

Lead Judging Commences

yeahchibyke Lead Judge 5 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.