Skip to content

Commit c179599

Browse files
authored
Fix audit bugs (#75)
1 parent 288a224 commit c179599

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

solana-programs/programs/cron/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cron"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
description = "Created with Anchor"
55
edition = "2021"
66

solana-programs/programs/cron/src/instructions/add_cron_transaction_v0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct AddCronTransactionV0<'info> {
2121
#[account(mut, has_one = authority)]
2222
pub cron_job: Box<Account<'info, CronJobV0>>,
2323
#[account(
24-
init_if_needed,
24+
init,
2525
payer = payer,
2626
seeds = [b"cron_job_transaction", cron_job.key().as_ref(), &args.index.to_le_bytes()[..]],
2727
bump,

solana-programs/programs/tuktuk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tuktuk"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
description = "Created with Anchor"
55
edition = "2021"
66

tuktuk-program/src/write_return_tasks.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ where
6868
};
6969

7070
let mut total_tasks = 0;
71+
let mut has_unprocessed_tasks = true;
7172
for AccountWithSeeds { account, seeds } in accounts.iter() {
7273
// Store original size before any reallocation
7374
original_sizes.push(account.data_len());
@@ -102,6 +103,7 @@ where
102103
loop {
103104
let task_bytes = current_task.try_to_vec()?;
104105
if offset + task_bytes.len() > MAX_PERMITTED_DATA_INCREASE {
106+
has_unprocessed_tasks = true;
105107
break; // This task will be handled by the next account
106108
}
107109

@@ -112,12 +114,14 @@ where
112114
total_tasks += 1;
113115

114116
// Get next task
115-
match tasks.next() {
116-
Some(task) => current_task = task,
117+
current_task = match tasks.next() {
118+
Some(task) => task,
117119
None => {
120+
has_unprocessed_tasks = false;
121+
// No more tasks, we're done
118122
break;
119123
}
120-
}
124+
};
121125
}
122126

123127
if num_tasks > 0 {
@@ -215,8 +219,8 @@ where
215219
account.realloc(0, false)?;
216220
}
217221

218-
// If we've processed all tasks, we can exit
219-
if num_tasks == 0 || tasks.next().is_none() {
222+
// If we have no more tasks to process, we can exit
223+
if num_tasks == 0 || !has_unprocessed_tasks {
220224
break;
221225
}
222226
}

0 commit comments

Comments
 (0)