]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: don't typecast socket to int for libssh2_session_handshake
authorDaniel Stenberg <daniel@haxx.se>
Mon, 21 Feb 2022 13:55:31 +0000 (14:55 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 21 Feb 2022 16:17:25 +0000 (17:17 +0100)
Since libssh2_socket_t uses SOCKET on windows which can be larger than
int.

Closes #8492

lib/vssh/libssh2.c

index f800bebc250d8d586d7a924f2507e88c5ad18ef4..db3967f5448c5230eb38d859853211e3088df56f 100644 (file)
@@ -433,7 +433,9 @@ static int sshkeycallback(struct Curl_easy *easy,
  * libssh2 1.2.8 fixed the problem with 32bit ints used for sockets on win64.
  */
 #ifdef HAVE_LIBSSH2_SESSION_HANDSHAKE
-#define libssh2_session_startup(x,y) libssh2_session_handshake(x,y)
+#define session_startup(x,y) libssh2_session_handshake(x, y)
+#else
+#define session_startup(x,y) libssh2_session_startup(x, (int)y)
 #endif
 
 static CURLcode ssh_knownhost(struct Curl_easy *data)
@@ -932,7 +934,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
       /* FALLTHROUGH */
 
     case SSH_S_STARTUP:
-      rc = libssh2_session_startup(sshc->ssh_session, (int)sock);
+      rc = session_startup(sshc->ssh_session, sock);
       if(rc == LIBSSH2_ERROR_EAGAIN) {
         break;
       }