Closed
Description
This is similar to issue #41 but not exactly the same.
When connecting to Tectia ssh server running on a mainframe, I intermittently got an exception: Data longer than 2147483647 is not supported.
Tracing into the code I found that it looks like sometimes the first 4 bytes in the SSH_MSG_IGNORE message are filled with arbitrary numbers instead of the actual data length. When the number is greater than int.MaxValue the exception is thrown.
Changing IgnoreMessage.LoadData to the following fixed the issue:
protected override void LoadData()
{
var dataLength = ReadUInt32();
if (dataLength > (DataStream.Length - DataStream.Position))
{
DiagnosticAbstraction.Log("SSH_MSG_IGNORE: Length exceeds data bytes, data ignored.");
Data = Array<byte>.Empty;
}
else if (dataLength > int.MaxValue)
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Data longer than {0} is not supported.", int.MaxValue));
}
else
{
Data = ReadBytes((int) dataLength);
}
}
The server version says "SSH-2.0-4.3.6500.1 SSH Secure Shell".
Metadata
Metadata
Assignees
Labels
No labels