Skip to content
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

libssh backend and homedir memory handling #3402

Closed
bagder opened this issue Dec 21, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@bagder
Copy link
Member

commented Dec 21, 2018

I did this

I did a debug-build of curl built with the libssh backend and ran the test suite.

I expected the following

I ran into issues because it turns out we try to free the pointer that libssh has returned from its sftp_canonicalize_path function.

All memory allocations in a debug build are subject for extra handling and thus it cannot easily mix with memory allocated without the debug-layer. But when I instead changed to use the "real" free() directly on this pointer, that also caused crashes. I could only make it run fine by completely avoiding the free of that data!

I reported the lack of docs for this function to the libssh project.

curl/libcurl version

curl 7.64.0-DEV (x86_64-pc-linux-gnu) libcurl/7.64.0-DEV (GnuTLS/3.6.5) OpenSSL/1.1.1a zlib/1.2.11 brotli/1.0.7 c-ares/1.14.0 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.8.5/openssl/zlib nghttp2/1.35.0-DEV librtmp/2.3

operating system

(unstable) Debian Linux, got the libssh version from the regular debian repo.

@bagder bagder added the SCP/SFTP label Dec 21, 2018

bagder added a commit that referenced this issue Dec 21, 2018

bagder added a commit that referenced this issue Dec 21, 2018

libssh: free sftp_canonicalize_path() data correctly
Assisted-by: Harry Sintonen

Fixes #3402
Closes #3403

@bagder bagder closed this in d18a5af Dec 22, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.