]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: fix crash in keyboard callback
authorJay Satiro <raysatiro@yahoo.com>
Tue, 25 Apr 2023 19:31:33 +0000 (15:31 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Wed, 26 Apr 2023 19:04:29 +0000 (15:04 -0400)
- Always set the libssh2 'abstract' user-pointer to the libcurl easy
  handle associated with the ssh session, so it is always passed to the
  ssh keyboard callback.

Prior to this change and since 8b5f100 (precedes curl 8.0.0), if libcurl
was built without CURL_DEBUG then it could crash during the ssh auth
phase due to a null dereference in the ssh keyboard callback.

Reported-by: Andreas Falkenhahn
Fixes https://github.com/curl/curl/pull/11024
Closes https://github.com/curl/curl/pull/11026

lib/vssh/libssh2.c

index f2e5352d1fd3acce0be9cee3a05e39e12811a122..bfcc94e16017833ba4f2cadcce49c7218c9d0974 100644 (file)
@@ -3274,7 +3274,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
                                               my_libssh2_free,
                                               my_libssh2_realloc, data);
 #else
-  sshc->ssh_session = libssh2_session_init();
+  sshc->ssh_session = libssh2_session_init_ex(NULL, NULL, NULL, data);
 #endif
   if(!sshc->ssh_session) {
     failf(data, "Failure initialising ssh session");