Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions program/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ fn is_program_authority(
let expected_program_data = {
let data = unsafe { program.borrow_unchecked() };
match (data.first(), program.executable()) {
(Some(2 /* program discriminator */), true) => {
let offset: usize = 4 /* discriminator */;
// The discriminator is 4 bytes, but we only need to check the first byte
// since there are fewer than 256 account types.
(Some(2), true) => {
let offset: usize = 4;
Address::try_from(&data[offset..offset + ADDRESS_BYTES])
.map_err(|_| ProgramError::InvalidAccountData)?
}
Expand Down
Loading