This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 0da9e23c693323fe1d4f42ee702f0c2d8a1bd534
Author: Lyor Goldstein <lgoldst...@apache.org>
AuthorDate: Thu Apr 23 21:32:35 2020 +0300

    [SSHD-979] Ignore by default any data written to error stream of SFTP 
subsystem client channel
---
 .../sshd/client/subsystem/sftp/impl/DefaultSftpClient.java       | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/DefaultSftpClient.java
 
b/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/DefaultSftpClient.java
index cf00605..136503d 100644
--- 
a/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/DefaultSftpClient.java
+++ 
b/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/DefaultSftpClient.java
@@ -18,7 +18,6 @@
  */
 package org.apache.sshd.client.subsystem.sftp.impl;
 
-import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InterruptedIOException;
@@ -61,6 +60,7 @@ import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
+import org.apache.sshd.common.util.io.NullOutputStream;
 
 /**
  * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
@@ -589,8 +589,11 @@ public class DefaultSftpClient extends AbstractSftpClient {
         }
 
         protected OutputStream createErrOutputStream(Session session) {
-            // TODO use some limit in case some data is constantly written to 
this stream
-            return new ByteArrayOutputStream();
+            /*
+             * The protocol does not specify how to handle such data but we 
are lenient and ignore it - similar to
+             * /dev/null
+             */
+            return new NullOutputStream();
         }
     }
 }

Reply via email to