You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2015/02/10 12:00:13 UTC

mina-sshd git commit: [SSHD-400] Ignore SFTP extension data in SSH_FXP_INIT message

Repository: mina-sshd
Updated Branches:
  refs/heads/master 2893dcc42 -> 46216f91e


[SSHD-400] Ignore SFTP extension data in SSH_FXP_INIT message

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/46216f91
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/46216f91
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/46216f91

Branch: refs/heads/master
Commit: 46216f91e7613d9590abd913dd966521ea4a9266
Parents: 2893dcc
Author: Guillaume Nodet <gn...@apache.org>
Authored: Tue Feb 10 11:59:38 2015 +0100
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Tue Feb 10 11:59:38 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/sshd/server/sftp/SftpSubsystem.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/46216f91/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
index 6382aac..3ce1c78 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
@@ -460,9 +460,10 @@ public class SftpSubsystem implements Command, Runnable, SessionAware, FileSyste
         int id = buffer.getInt();
         switch (type) {
             case SSH_FXP_INIT: {
-                log.debug("Received SSH_FXP_INIT (version={})", version);
-                if (length != 5) {
-                    throw new IllegalArgumentException();
+                log.debug("Received SSH_FXP_INIT (version={})", id);
+                // see https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt - section 4 - Protocol Initialization
+                if (length < 5) { // we don't care about extensions
+                    throw new IllegalArgumentException("Incomplete SSH_FXP_INIT data: length=" + length);
                 }
                 version = id;
                 if (version >= LOWER_SFTP_IMPL) {