Skip to content

Commit 2f37967

Browse files
committed
More relax instruction data length check
1 parent df7e7c3 commit 2f37967

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

p-token/src/processor/approve_checked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use {
77
#[inline(always)]
88
pub fn process_approve_checked(accounts: &[AccountInfo], instruction_data: &[u8]) -> ProgramResult {
99
// expected u64 (8) + u8 (1)
10-
let (amount, decimals) = if instruction_data.len() == 9 {
10+
let (amount, decimals) = if instruction_data.len() >= 9 {
1111
let (amount, decimals) = instruction_data.split_at(U64_BYTES);
1212
(
1313
// SAFETY: The size of `amount` is `U64_BYTES` bytes.

p-token/src/processor/burn_checked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use {
77
#[inline(always)]
88
pub fn process_burn_checked(accounts: &[AccountInfo], instruction_data: &[u8]) -> ProgramResult {
99
// expected u64 (8) + u8 (1)
10-
let (amount, decimals) = if instruction_data.len() == 9 {
10+
let (amount, decimals) = if instruction_data.len() >= 9 {
1111
let (amount, decimals) = instruction_data.split_at(U64_BYTES);
1212
(
1313
// SAFETY: The size of `amount` is `U64_BYTES` bytes.

p-token/src/processor/transfer_checked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn process_transfer_checked(
1010
instruction_data: &[u8],
1111
) -> ProgramResult {
1212
// expected u64 (8) + u8 (1)
13-
let (amount, decimals) = if instruction_data.len() == 9 {
13+
let (amount, decimals) = if instruction_data.len() >= 9 {
1414
let (amount, decimals) = instruction_data.split_at(U64_BYTES);
1515
(
1616
// SAFETY: The size of `amount` is `U64_BYTES` bytes.

0 commit comments

Comments
 (0)