GH-468: Handle excess data in SFTP read requests by tomaswolf · Pull Request #495 · apache/mina-sshd (original) (raw)

@tomaswolf

Some SFTP servers appear to return sometimes more data than requested. If that happened, it was possible that a downloaded file would be corrupted (size larger than expected, and some duplicated data inside the file).

By default, throw an exception if an SFTP server returns more data than requested. If property SftpModuleProperties.TOLERATE_EXCESS_DATA is set to true on the session or on the channel, discard such excess data and log a warning.

Avoid code duplication; unify SSH_FXP_READ response handling in AbstractSftpClient.