Skip to content

Commit 88de2b9

Browse files
authored
ensure that 0 length reads return an empty array not null (#3872)
1 parent 2f9f533 commit 88de2b9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,9 +2356,10 @@ internal TdsOperationStatus TryReadPlpBytes(ref byte[] buff, int offset, int len
23562356
{
23572357
// if there is a snapshot which it contains a stored plp buffer take it
23582358
// and try to use it if it is the right length
2359-
buff = TryTakeSnapshotStorage() as byte[];
2360-
if (buff != null)
2359+
byte[] existingBuff = TryTakeSnapshotStorage() as byte[];
2360+
if (existingBuff != null)
23612361
{
2362+
buff = existingBuff;
23622363
totalBytesRead = _snapshot.GetPacketDataOffset();
23632364
}
23642365
}

0 commit comments

Comments
 (0)