Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Missing checks for `address(0)` when assigning values to address state variables

Description: Check for address(0) when assigning values to address state variables.

Impact: i_WBTC, i_WETH, i_USDC are immutable. Once the value is assigned, it cannot be changed. Furthermore, if the host is set to address(0), it will be impossible to change the host or withdraw funds.

Recommended Mitigation: Check `address(0) before assign value.

constructor (address _WBTC, address _WETH, address _USDC) {
host = msg.sender;
+ require(_WBTC != address(0) && _WETH != address(0) && _USDC != address(0), "Cannot assign address(0)");
i_WBTC = IERC20(_WBTC); // @audit-low: missing check address(0)
whitelisted[_WBTC] = true;
i_WETH = IERC20(_WETH);
whitelisted[_WETH] = true;
i_USDC = IERC20(_USDC);
whitelisted[_USDC] = true;
}
function changeHost(address _newHost) external onlyHost {
+ require(_newHost _USDC != address(0), "Cannot assign address(0)");
if(!participant[_newHost]) {
revert OnlyParticipantsCanBeHost();
}
host = _newHost; // @audit-low Missing checks for address(0) when assigning values to address state variables
emit NewHost(host);
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!