From: Daniel Stenberg Date: Thu, 17 Jun 2021 08:25:53 +0000 (+0200) Subject: libssh2: limit time a disconnect can take to 1 second X-Git-Tag: curl-7_78_0~126 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa34353d07e1d3053ae55b91d3971edf548d238a;p=thirdparty%2Fcurl.git libssh2: limit time a disconnect can take to 1 second Closes #7271 --- diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 8a6345b948..ec94747090 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -2938,6 +2938,7 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data, { struct ssh_conn *sshc = &conn->proto.sshc; CURLcode result = CURLE_OK; + struct curltime dis = Curl_now(); while((sshc->state != SSH_STOP) && !result) { bool block; @@ -2962,6 +2963,12 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data, return CURLE_OPERATION_TIMEDOUT; } } + else if(Curl_timediff(now, dis) > 1000) { + /* disconnect timeout */ + failf(data, "Disconnect timed out"); + result = CURLE_OK; + break; + } if(block) { int dir = libssh2_session_block_directions(sshc->ssh_session);