Skip to content

Commit

Permalink
Only decrypt known size
Browse files Browse the repository at this point in the history
  • Loading branch information
nyonson committed Apr 20, 2024
1 parent 85b9461 commit 2a61042
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ impl PacketReader {
/// # Arguments
///
/// - `ciphertext` - The message from the peer.
/// - `contents` - Mutable buffer to write plaintext.
/// - `aad` - Optional authentication for the peer, currently only used for the first round of messages.
/// - `contents` - Mutable buffer to write plaintext.
/// - `aad` - Optional authentication for the peer, currently only used for the first round of messages.
///
/// # Errors
///
Expand All @@ -207,7 +207,7 @@ impl PacketReader {
contents[0..msg.len()].copy_from_slice(msg);
self.packet_decoding_cipher.decrypt(
auth,
contents,
&mut contents[0..msg.len()],
tag.try_into().map_err(|_| Error::MessageLengthTooSmall)?,
)?;

Expand Down

0 comments on commit 2a61042

Please sign in to comment.