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

Location

  • Found in src/ChristmasDinner.sol [Line: 171]()

    host = _newHost;

Issue
When changing the host (changeHost function), the contract directly sets host to _newHost without validating that _newHost is a non-zero address. Although the contract does require _newHost to be a participant, there is no explicit revert if _newHost is address(0).

Impact

  • A malicious or accidental call could set the host to the zero address, breaking subsequent logic that relies on a valid host.

  • Could cause confusion or potential denial of service if the host is invalid.

Recommendation

  • Add a check to prevent assigning address(0) as the new host:

    require(_newHost != address(0), "New host cannot be zero address");
  • Retain or strengthen the existing check that _newHost must be a participant to protect contract invariants.

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!