|
@@ -50,7 +50,8 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
|
|
|
|
|
|
match authority_type {
|
|
match authority_type {
|
|
AuthorityType::AccountOwner => {
|
|
AuthorityType::AccountOwner => {
|
|
- validate_owner(&account.owner, authority_info, remaining)?;
|
|
|
|
|
|
+ // SAFETY: `authority_info` is not currently borrowed.
|
|
|
|
+ unsafe { validate_owner(&account.owner, authority_info, remaining)? };
|
|
|
|
|
|
if let Some(authority) = new_authority {
|
|
if let Some(authority) = new_authority {
|
|
account.owner = *authority;
|
|
account.owner = *authority;
|
|
@@ -67,7 +68,8 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
|
|
}
|
|
}
|
|
AuthorityType::CloseAccount => {
|
|
AuthorityType::CloseAccount => {
|
|
let authority = account.close_authority().unwrap_or(&account.owner);
|
|
let authority = account.close_authority().unwrap_or(&account.owner);
|
|
- validate_owner(authority, authority_info, remaining)?;
|
|
|
|
|
|
+ // SAFETY: `authority_info` is not currently borrowed.
|
|
|
|
+ unsafe { validate_owner(authority, authority_info, remaining)? };
|
|
|
|
|
|
if let Some(authority) = new_authority {
|
|
if let Some(authority) = new_authority {
|
|
account.set_close_authority(authority);
|
|
account.set_close_authority(authority);
|
|
@@ -90,7 +92,8 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
|
|
// mint_authority.
|
|
// mint_authority.
|
|
let mint_authority = mint.mint_authority().ok_or(TokenError::FixedSupply)?;
|
|
let mint_authority = mint.mint_authority().ok_or(TokenError::FixedSupply)?;
|
|
|
|
|
|
- validate_owner(mint_authority, authority_info, remaining)?;
|
|
|
|
|
|
+ // SAFETY: `authority_info` is not currently borrowed.
|
|
|
|
+ unsafe { validate_owner(mint_authority, authority_info, remaining)? };
|
|
|
|
|
|
if let Some(authority) = new_authority {
|
|
if let Some(authority) = new_authority {
|
|
mint.set_mint_authority(authority);
|
|
mint.set_mint_authority(authority);
|
|
@@ -105,7 +108,8 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
|
|
.freeze_authority()
|
|
.freeze_authority()
|
|
.ok_or(TokenError::MintCannotFreeze)?;
|
|
.ok_or(TokenError::MintCannotFreeze)?;
|
|
|
|
|
|
- validate_owner(freeze_authority, authority_info, remaining)?;
|
|
|
|
|
|
+ // SAFETY: `authority_info` is not currently borrowed.
|
|
|
|
+ unsafe { validate_owner(freeze_authority, authority_info, remaining)? };
|
|
|
|
|
|
if let Some(authority) = new_authority {
|
|
if let Some(authority) = new_authority {
|
|
mint.set_freeze_authority(authority);
|
|
mint.set_freeze_authority(authority);
|