accounts/scwallet: fix panic in decryptAPDU

This commit is contained in:
BZO95 2026-01-14 20:16:15 +08:00
parent 94710f79a2
commit e87a214a44

View file

@ -300,6 +300,10 @@ func (s *SecureChannelSession) decryptAPDU(data []byte) ([]byte, error) {
return nil, err
}
if len(data) == 0 || len(data)%aes.BlockSize != 0 {
return nil, fmt.Errorf("invalid ciphertext length: %d", len(data))
}
ret := make([]byte, len(data))
crypter := cipher.NewCBCDecrypter(a, s.iv)