Skip to content

Commit 73375ae

Browse files
vkuttypCopilot
andcommitted
fix: ReadBytesExact was calling itself instead of r.ReadBytes()
Infinite recursion caused StackOverflowException on every query. ReadBytesExact must call r.ReadBytes(count) as the base read, then check the returned length. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bd76500 commit 73375ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/SqlDotnetty.MsSql/Tds/TdsDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ private static SqlValue ReadDateTimeOffset(BinaryReader r, byte scale)
803803
private static byte[] ReadBytesExact(BinaryReader r, int count)
804804
{
805805
if (count == 0) return Array.Empty<byte>();
806-
var buf = ReadBytesExact(r, count);
806+
var buf = r.ReadBytes(count);
807807
if (buf.Length < count) throw new EndOfStreamException(
808808
$"Expected {count} bytes but stream contained only {buf.Length}.");
809809
return buf;

0 commit comments

Comments
 (0)