Re-instate the length check for Le bytes

This commit is contained in:
Kamran Khan
2020-12-14 04:54:25 -08:00
parent dbbdddd58b
commit 35bdfe90ed
2 changed files with 4 additions and 1 deletions

View File

@@ -179,6 +179,9 @@ impl TryFrom<&[u8]> for APDU {
.len()
.checked_sub(extended_apdu_lc + 3)
.ok_or(ApduStatusCode::SW_WRONG_LENGTH)?;
if extended_apdu_le_len > 3 {
return Err(ApduStatusCode::SW_WRONG_LENGTH);
}
if byte_0 == 0 && extended_apdu_le_len <= 3 {
// If first byte is zero AND the next two bytes can be parsed as a big-endian