diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs index 4366b4665a..c7d170f442 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParser.cs @@ -25,6 +25,8 @@ internal void ProcessSSPI(int receivedLength) throw SQL.SynchronousCallMayNotPend(); } + receivedBuff.AsSpan(receivedLength, receivedBuff.Length - receivedLength).Clear(); + // allocate send buffer and initialize length byte[] rentedSendBuff = ArrayPool.Shared.Rent((int)_authenticationProvider!.MaxSSPILength); byte[] sendBuff = rentedSendBuff; // need to track these separately in case someone updates the ref parameter