The TridentNFT._mint_ function allows minting to the zero address.
Impact
As existence of an NFT is checked by ownerOf[tokenId] != address(0), minting to the zero address should be disallowed.
The same tokenId can be minted several times to the zero address, increasing balanceOf[0] each time.
Handle
cmichel
Vulnerability details
The
TridentNFT._mint_
function allows minting to the zero address.Impact
As existence of an NFT is checked by
ownerOf[tokenId] != address(0)
, minting to the zero address should be disallowed. The sametokenId
can be minted several times to the zero address, increasingbalanceOf[0]
each time.Recommended Mitigation Steps
Add a check for
recipient != address(0)
.