Skip to content

Commit d4b1fc9

Browse files
committed
correct span allocation
1 parent b0fc525 commit d4b1fc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DataProtection/Extensions/src/TimeLimitedDataProtector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public bool TryProtect(ReadOnlySpan<byte> plaintext, Span<byte> destination, Dat
166166
try
167167
{
168168
plainTextWithHeader = ArrayPool<byte>.Shared.Rent(plaintext.Length + ExpirationTimeHeaderSize);
169-
var plainTextWithHeaderSpan = plainTextWithHeader.AsSpan();
169+
var plainTextWithHeaderSpan = plainTextWithHeader.AsSpan(0, plaintext.Length + ExpirationTimeHeaderSize);
170170

171171
// We prepend the expiration time (as a 64-bit UTC tick count) to the unprotected data.
172172
BitHelpers.WriteUInt64(plainTextWithHeaderSpan, 0, (ulong)expiration.UtcTicks);

0 commit comments

Comments
 (0)