refactor: address panics due to indexing and slicing (#3233)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2024-01-05 14:47:37 +05:30
committed by GitHub
parent 000e644388
commit 34318bc1f1
39 changed files with 244 additions and 253 deletions

View File

@ -279,7 +279,10 @@ impl DecodeMessage for GcmAes256 {
.change_context(errors::CryptoError::DecodingFailed)?;
let nonce_sequence = NonceSequence::from_bytes(
msg[..ring::aead::NONCE_LEN]
msg.get(..ring::aead::NONCE_LEN)
.ok_or(errors::CryptoError::DecodingFailed)
.into_report()
.attach_printable("Failed to read the nonce form the encrypted ciphertext")?
.try_into()
.into_report()
.change_context(errors::CryptoError::DecodingFailed)?,