Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: medium

Unconventional i++ placement

Summary

Unconventional i++ placement might be risky in the long-term

Vulnerability Details

The problem with the i++ placement might arise in future updates of the contract. If for some reason logic is added after the i++, or something before it makes it not reach the i++ the loop could become infinite.

constructor(address[] memory _whitelistedTokens) EIP712("ProxyFactory", "1") Ownable() {
    if (_whitelistedTokens.length == 0) revert ProxyFactory__NoEmptyArray();
    for (uint256 i; i < _whitelistedTokens.length;) {
        if (_whitelistedTokens[i] == address(0)) revert ProxyFactory__NoZeroAddress();
        whitelistedTokens[_whitelistedTokens[i]] = true;
        unchecked {
            i++;
        }
    }
}

Impact

Low, might become big.

Tools Used

Recommendations

Use the standart i++ placement.

Support

FAQs

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