cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl crahes when an SFTP server's home directory is non-exist

From: 暖和的和暖 _ <>
Date: Fri, 17 Jun 2016 15:22:07 +0000

On Thu, 16 Jun 2016, Daniel Stenberg  _ wrote:

> Then I guess I didn't understand your problem. How does it end up crashing?

    else {
         /* Return the error type */
          err = sftp_libssh2_last_error(sshc->sftp_session);
          result = sftp_libssh2_error_to_CURLE(err);
          sshc->actualcode = result?result:CURLE_SSH;
    In this case though the "rc" is -9(TIMEOUT), "err" returned by sftp_libssh2_last_error is 0,
    which makes result = CURLE_OK and the state machine continues SFTP operation.

    Below is from description of API libssh2_sftp_last_error(which macro sftp_libssh2_last_error expands to ).

    "Returns the last error code produced by the SFTP layer. Note that this only returns a sensible error code if libssh2 returned LIBSSH2_ERROR_SFTP_PROTOCOL in a previous call."
    Maybe here need to revise the "result" since the "err" cannot be fully trusted,
    something equals to
     if(result == CURLE_OK)
         result = CURLE_SSH;
> Ok, and as a libssh2 hacker I will appreciate that. But since this crash is
> within libcurl within an existing libssh2 release I think we need to also add
> some extra checks in libcurl to make sure it'll work for all those using this
> or older libssh2 versions!

      Thanks again.

Huo Jiachuan

List admin:
Received on 2016-06-17