Skip to content

Commit 1dbf9b7

Browse files
authored
added check for system account owner (#12)
1 parent b2673e2 commit 1dbf9b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/src/helpers.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ pub fn check_readonly(account: &AccountInfo) -> ProgramResult {
7474
}
7575

7676
pub fn check_uninitialized_pda(account: &AccountInfo, seeds: &[&[u8]], bump: u8, program_id: &Pubkey) -> ProgramResult {
77+
if !account.owner.eq(&system_program::ID) {
78+
return Err(ProgramError::InvalidAccountData);
79+
}
80+
7781
account.is_empty()?.is_writable()?.has_seeds(seeds, bump, program_id)?;
7882
Ok(())
7983
}

0 commit comments

Comments
 (0)