Zk instructions check length (#24103)
* zk-token-sdk: add a length check before decoding proof instruction * zk-token-sdk: fix minor spelling * zk-token-sdk: one-liner for length check * zk-token-sdk: one-liner fix
This commit is contained in:
@ -56,7 +56,7 @@ pub fn process_instruction(
|
|||||||
verify::<WithdrawData>(invoke_context)
|
verify::<WithdrawData>(invoke_context)
|
||||||
}
|
}
|
||||||
ProofInstruction::VerifyWithdrawWithheldTokens => {
|
ProofInstruction::VerifyWithdrawWithheldTokens => {
|
||||||
ic_msg!(invoke_context, "VerifyWithdraw");
|
ic_msg!(invoke_context, "VerifyWithdrawWithheldTokens");
|
||||||
verify::<WithdrawData>(invoke_context)
|
verify::<WithdrawData>(invoke_context)
|
||||||
}
|
}
|
||||||
ProofInstruction::VerifyTransfer => {
|
ProofInstruction::VerifyTransfer => {
|
||||||
|
@ -73,7 +73,7 @@ impl ProofInstruction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_type(input: &[u8]) -> Option<Self> {
|
pub fn decode_type(input: &[u8]) -> Option<Self> {
|
||||||
FromPrimitive::from_u8(input[0])
|
input.get(0).and_then(|x| FromPrimitive::from_u8(*x))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_data<T: Pod>(input: &[u8]) -> Option<&T> {
|
pub fn decode_data<T: Pod>(input: &[u8]) -> Option<&T> {
|
||||||
|
Reference in New Issue
Block a user