Christmas Dinner

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

The `ChristmasDinner::deadlineSet` is never updated to `true` when calling `ChristmasDinner::setDeadline`, allowing multiple change of deadlines.

Description

The global variable ChristmasDinner::deadlineSet is not updated to true when setting the deadline by calling ChristmasDinner::setDeadline.

Impact

The contract allows multiple change of deadlines.

Proof of Concepts

The test ChristmasDinnerTest::test_tryResettingDeadlineAsHost already proves that the deadline can be updated by calling the function ChristmasDinner::setDeadline more than once.

Recommended mitigation

Add the following change to the code.

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 8 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.