RustFund

First Flight #36
Beginner FriendlyRust
100 EXP
View results
Submission Details
Severity: medium
Valid

Missing `deadline_set` Flag Update and Typo

Description

The set_deadline function updates the deadline field but does not set the deadline_set flag (misspelled as dealine_set in the account struct) to true. This allows the creator to call set_deadline multiple times, bypassing the intended single-use constraint.


Impact

  • Unintended Deadline Changes: The creator can repeatedly modify the deadline, disrupting fund logic (e.g., extending deadlines indefinitely).

  • Code Confusion: The misspelled dealine_set field causes readability issues and potential future bugs.


Affected Code

// Misspelled struct field:
pub dealine_set: bool, // Should be `deadline_set`
// In set_deadline function:
pub fn set_deadline(...) {
// ...
fund.deadline = deadline;
// MISSING: fund.deadline_set = true;
}

Recommendation

  1. Fix the Typo: Rename the struct field to deadline_set.

  2. Update the Flag: Set deadline_set to true after assigning the deadline.

Corrected Code:

// Line 222
#[account]
#[derive(InitSpace)]
pub struct Fund {
// ...
pub dealine_set: bool,
}
// Line 67
pub fn set_deadline(...) {
// ...
fund.deadline = deadline;
fund.deadline_set = true; // Set flag
}
Updates

Appeal created

bube Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Deadline set flag is not updated in `set_deadline` function

Support

FAQs

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