20,000 USDC
View results
Submission Details
Severity: low
Valid

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

Summary

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

Vulnerability Details

Lack of zero-address validation on address parameters may lead to transaction reverts, waste gas,
require resubmission of transactions and may even force contract redeployments in certain cases within the protocol.

This check is considered important as:

  • Nobody owns this address, either externally-owned account (EOA) or by any contract.

  • Because the value 0 is the default uninitialized value, it can be aeasily passed to the functions by mistake

  • Because the value 0 is the default uninitialized value, address(0) might often be used to check if an address has been initialized or not

File: src/Lender.sol
101: feeReceiver = _feeReceiver;

Link to code - https://github.com/Cyfrin/2023-07-beedle/tree/main/src/Lender.sol

File: src/utils/Ownable.sol
15: owner = _owner;
20: owner = _owner;

Link to code - https://github.com/Cyfrin/2023-07-beedle/tree/main/src/utils/Ownable.sol

Tools Used

Code Review

Recommendations

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

Auditor

NeoCrao

Support

FAQs

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