Fix handling of empty line.

This commit is contained in:
drieseng
2020-12-27 12:06:36 +01:00
parent e71a4c958d
commit fbadaf8b74
+6 -7
View File
@@ -118,14 +118,13 @@ namespace Renci.SshNet.Connection
break;
var b = data[0];
if (b == Session.LineFeed && buffer.Count > 1 && buffer[buffer.Count - 1] == Session.CarriageReturn)
{
// Return line without CR
return encoding.GetString(buffer.ToArray(), 0, buffer.Count - 1);
}
buffer.Add(b);
if (b == Session.LineFeed && buffer.Count > 1 && buffer[buffer.Count - 2] == Session.CarriageReturn)
{
// Return line without CRLF
return encoding.GetString(buffer.ToArray(), 0, buffer.Count - 2);
}
}
while (true);