RustFund

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

deadline_set Not Updated in set_deadline Function

Summary

The set_deadline function doesn't update the deadline_set flag of the Fund account to true after successfully setting a deadline. This oversight may lead to incorrect behavior when attempting to set a deadline multiple times.

Vulnerability Details

In the current implementation of the set_deadline function, the deadline_set field remains false even after a deadline is successfully set.
The relevant code snippet is as follows:

pub fn set_deadline(ctx: Context<FundSetDeadline>, deadline: u64) -> Result<()> {
let fund = &mut ctx.accounts.fund;
if fund.dealine_set {
return Err(ErrorCode::DeadlineAlreadySet.into());
}
fund.deadline = deadline;
Ok(())
}

Impact

Potential Bugs: If future functions rely on the deadline_set field to determine whether a deadline can be modified, this oversight could introduce bugs and inconsistencies in behavior.

User Experience: Users may encounter unexpected behavior when interacting with the fund, which could diminish trust in the platform.

Tools Used

Manual Review

Recommendations

pub fn set_deadline(ctx: Context<FundSetDeadline>, deadline: u64) -> Result<()> {
let fund = &mut ctx.accounts.fund;
if fund.dealine_set {
return Err(ErrorCode::DeadlineAlreadySet.into());
}
fund.deadline = deadline;
[+] fund.dealine_set = true;
Ok(())
}
Updates

Appeal created

bube Lead Judge 2 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.