Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Improper Handling of deadlineSet Flag in setDeadline Function

Summary:

The deadlineSet flag is not updated immediately after the deadline is set, potentially allowing for multiple changes to the deadline even after it has been set once.

Vulnerability Details:

The deadlineSet flag is supposed to prevent any further changes to the deadline after it has been set. However, the flag is not updated until after the deadline is assigned, which could cause issues if multiple calls are made before the flag is properly set.

Impact:

If the setDeadline function is called multiple times before the deadlineSet flag is properly updated, it could lead to changes in the deadline after it has already been set, violating the intended behavior of the function.

Tools Used:

Manual inspection

Recommendations:

Set the deadlineSet flag to true immediately after the deadline is set, before any further actions are taken.

Corrected Code:

function setDeadline(uint256 _days) external onlyHost {
if (deadlineSet) {
revert DeadlineAlreadySet();
}
deadline = block.timestamp + _days * 1 days;
deadlineSet = true; // Set to true
emit DeadlineSet(deadline);
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

deadline is never set to true

Support

FAQs

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

Give us feedback!