sherlock-audit / 2022-11-telcoin-judging

0 stars 0 forks source link

Deivitto - Missing check of `0x0` in initialize for `tel` #90

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Deivitto

low

Missing check of 0x0 in initialize for tel

Summary

Missing check of 0x0 in initialize for tel

Vulnerability Detail

Impact

Zero address should be checked for state variables.

A zero address can make the code where tel not work as expected and most likely fail.

Code Snippet

https://github.com/sherlock-audit/2022-11-telcoin/blob/main/contracts/StakingModule.sol#L60-L61

function initialize(address _telAddress) public payable initializer {
    tel = _telAddress;

    // initialize OZ stuff
    ReentrancyGuardUpgradeable.__ReentrancyGuard_init_unchained();
    AccessControlEnumerableUpgradeable.__AccessControlEnumerable_init_unchained();
    PausableUpgradeable.__Pausable_init_unchained();

    // set deployer as ADMIN
    _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}

Tool used

Manual Review

Recommendation

Check zero address before assigning or using it