Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Missing zero _tokenAddress check in sendERC20(), InheritanceManager.sol

Summary

The sendERC20 function doesn't check if _tokenAddress is a valid ERC-20 token address.

Vulnerability Details

function sendERC20(address _tokenAddress, uint256 _amount, address _to) external nonReentrant onlyOwner {
if (IERC20(_tokenAddress).balanceOf(address(this)) < _amount) {
revert InsufficientBalance();
}
IERC20(_tokenAddress).safeTransfer(_to, _amount);
_setDeadline();
}

Calling a zero address can cause the execution to fail reverting the entire transaction.

Impact

Potential funds loss

Wasting gas

Tools Used

Manual review

Recommendations

Fixed code:

function sendERC20(address _tokenAddress, uint256 _amount, address _to) external nonReentrant onlyOwner {
if (IERC20(_tokenAddress).balanceOf(address(this)) < _amount) {
revert InsufficientBalance();
}
if (_tokenAddress == address(0)) {
revert InvalitTokenAddress();
}
IERC20(_tokenAddress).safeTransfer(_to, _amount);
_setDeadline();
}
Updates

Lead Judging Commences

0xtimefliez 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.