-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFTP segfault #9737
Comments
This is intermittent and highly depending on timing. |
I happen to be using PHP, but that is not relevant to the issue. |
Can you provide more information on this? I was unable to reproduce (shutting down the server during a transfer) |
(gdb) where |
Core was generated by `php /home/importer/download/vendor/redx/data/lsftp --force'. |
Looking at the source code of libssh, I don't think sftp_init sets ssh error in two cases. |
sftp_init does set ssh error in many cases, but I don't think all cases. |
If it returns a zero after an ssh error, I would say that is a libssh error we should report to them but also fix, as proposed. |
Let me also emphasize that the patch proposed in this issue gets the sftp error code, not the ssh error code. That seems to be wrong. Isn't it? |
I've filed an issue with libssh |
This flow extracted the wrong code (sftp code instead of ssh code), and the code is sometimes (erroneously) returned as zero anyway, so skip getting it and set a generic error. Reported-by: David McLaughlin Fixes #9737
I agree. I didn't know what to return, but continuing as if there was no error was not correct. |
That was just how gdb thought of it. I agree it is simply 0. |
by the way a sanity check in file lib/curl_path.c on line 183 to ensure homedir is not null is probably in order. |
Agreed, The |
I did this
normally run cURL on using sftp protocol.
I expected the following
error when the server issues an error.
curl/libcurl version
[curl -V output]
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
operating system
Ubuntu
VERSION="20.04 LTS (Focal Fossa)"
Linux ddaimportscript120 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
I have the patch, but I don't see how to submit it without an issue.
Here is the patch:
The sftp_get_error call following an sftp_get_error may return SSH_OK (currently in two code paths of libssh).
Without this patch, the code will not properly return an error which leads to a crash in Curl_getworkingpath asking for strlen of homedir=0x0.
The text was updated successfully, but these errors were encountered: