Christmas Dinner

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

`DeadlineSet` is Not Set to True When Deadline is Set, Causing Information Discrepancies

Vulnerability Details

Users are expected to be notified when the deadline is set by checking the global variable deadlineSet, which should return true if the deadline is set, or false otherwise. However, when the host sets the deadline, the deadlineSet variable is not updated, causing it to incorrectly return false even though the deadline has already been set.

Here is vulnerable code:

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

Impact

Users may receive incorrect information from the deadlineSet variable, and the host can change the date without notice.

Recommended Mitigation

To fix this issue, consider update the deadlineSet variable to true when deadline is set.

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

Lead Judging Commences

0xtimefliez Lead Judge about 1 year 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!