Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_safeMint() should be used rather than _mint() wherever possible #269

Closed
code423n4 opened this issue Oct 25, 2022 · 2 comments
Closed

_safeMint() should be used rather than _mint() wherever possible #269

code423n4 opened this issue Oct 25, 2022 · 2 comments
Labels
bug Something isn't working grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-10-holograph/blob/main/src/enforcer/HolographERC721.sol#L307
https://github.com/code-423n4/2022-10-holograph/blob/main/src/enforcer/HolographERC721.sol#L415

Vulnerability details

_safeMint() should be used rather than _mint() wherever possible

_mint() is discouraged in favor of _safeMint() which ensures that the recipient is either an EOA or implements IERC721Receiver. Both open OpenZeppelin and solmate have versions of this function so that NFTs aren’t lost if they’re minted to contracts that cannot transfer them back out.

Instances

HolographERC721.sol:L307

src/enforcer/HolographERC721.sol:307:    _mint(to, tokenId);

HolographERC721.sol:L415

src/enforcer/HolographERC721.sol:415:    _mint(to, token);

Recommendations:

Use _safeMint() instead of _mint().

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Oct 25, 2022
code423n4 added a commit that referenced this issue Oct 25, 2022
@gzeoneth
Copy link
Member

Duplicate of #462

@gzeoneth gzeoneth marked this as a duplicate of #462 Oct 30, 2022
@gzeoneth gzeoneth added the duplicate This issue or pull request already exists label Oct 30, 2022
@gzeoneth gzeoneth added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value duplicate This issue or pull request already exists labels Nov 21, 2022
@gzeoneth
Copy link
Member

As QA report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants