Skip to content

Commit

Permalink
IncrementalXChaCha20Poly1305.cs: Check ciphertextChunk length.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-lucas6 committed Nov 26, 2022
1 parent d092ba4 commit 16ba32a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Geralt/Crypto/IncrementalXChaCha20Poly1305.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public unsafe void Push(Span<byte> ciphertextChunk, ReadOnlySpan<byte> plaintext
public unsafe ChunkFlag Pull(Span<byte> plaintextChunk, ReadOnlySpan<byte> ciphertextChunk, ReadOnlySpan<byte> associatedData = default)
{
if (!_decryption) { throw new InvalidOperationException("Cannot pull from an encryption stream."); }
Validation.NotLessThanMin(nameof(ciphertextChunk), ciphertextChunk.Length, TagSize);
Validation.EqualToSize(nameof(plaintextChunk), plaintextChunk.Length, ciphertextChunk.Length - TagSize);
fixed (byte* p = plaintextChunk, c = ciphertextChunk, a = associatedData)
{
Expand Down

0 comments on commit 16ba32a

Please sign in to comment.