From 522ed129b249e37770448e6f9a7b58b5a584a4d7 Mon Sep 17 00:00:00 2001 From: Gert Driesen Date: Tue, 22 Aug 2017 18:32:57 +0200 Subject: [PATCH] Fix SL and WP compile. --- src/Renci.SshNet/ScpClient.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Renci.SshNet/ScpClient.cs b/src/Renci.SshNet/ScpClient.cs index d08d624b..12f9625b 100644 --- a/src/Renci.SshNet/ScpClient.cs +++ b/src/Renci.SshNet/ScpClient.cs @@ -400,10 +400,11 @@ namespace Renci.SshNet b = ReadByte(stream); } - if (hasError) - throw new ScpException(ConnectionInfo.Encoding.GetString(buffer.ToArray())); + var readBytes = buffer.ToArray(); - return ConnectionInfo.Encoding.GetString(buffer.ToArray()); + if (hasError) + throw new ScpException(ConnectionInfo.Encoding.GetString(readBytes, 0, readBytes.Length)); + return ConnectionInfo.Encoding.GetString(readBytes, 0, readBytes.Length); } } }