From 58c0a23fa905b458d12efec772aa2db950898070 Mon Sep 17 00:00:00 2001 From: olegkap_cp Date: Fri, 21 Dec 2012 13:52:31 +0000 Subject: [PATCH] Add locking in ShellStream Read function --- Renci.SshClient/Renci.SshNet/ShellStream.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Renci.SshClient/Renci.SshNet/ShellStream.cs b/Renci.SshClient/Renci.SshNet/ShellStream.cs index 180b623b..e1f65068 100644 --- a/Renci.SshClient/Renci.SshNet/ShellStream.cs +++ b/Renci.SshClient/Renci.SshNet/ShellStream.cs @@ -163,9 +163,12 @@ namespace Renci.SshNet { var i = 0; - for (; i < count && this._incoming.Count > 0; i++) + lock (this._incoming) { - buffer[offset + i] = this._incoming.Dequeue(); + for (; i < count && this._incoming.Count > 0; i++) + { + buffer[offset + i] = this._incoming.Dequeue(); + } } return i;