Skip to content

Commit 5260f1b

Browse files
committed
Number of bytes in read buffer can never be negative.
1 parent ad56cc9 commit 5260f1b

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/Renci.SshNet/Sftp/SftpFileStream.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ public override int Read(byte[] buffer, int offset, int count)
370370
Buffer.BlockCopy(data, 0, _readBuffer, 0, _bufferLen);
371371
_serverFilePosition = (ulong)_position;
372372

373-
if (_bufferLen < 0)
374-
{
375-
_bufferLen = 0;
376-
// TODO: Add SFTP error code or message if possible
377-
throw new IOException("Read operation failed.");
378-
}
379373
if (_bufferLen == 0)
380374
{
381375
break;
@@ -435,12 +429,6 @@ public override int ReadByte()
435429
Buffer.BlockCopy(data, 0, _readBuffer, 0, _readBufferSize);
436430
_serverFilePosition = (ulong)_position;
437431

438-
if (_bufferLen < 0)
439-
{
440-
_bufferLen = 0;
441-
// TODO: Add SFTP error code or message if possible
442-
throw new IOException("Read operation failed.");
443-
}
444432
if (_bufferLen == 0)
445433
{
446434
// We've reached EOF.

0 commit comments

Comments
 (0)