From: Daniel Stenberg Date: Sat, 24 Feb 2024 21:38:22 +0000 (+0100) Subject: libssh/libssh2: return error on too big range X-Git-Tag: curl-8_7_0~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f47487c219978cd9d9db34f7b1669e5e44051af1;p=thirdparty%2Fcurl.git libssh/libssh2: return error on too big range If trying to get the range 0 - 2^63 and the remote file is 2^63 bytes or larger. Fixes #12983 Closes #12984 --- diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index c6dc63ae66..02148d0c18 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -1665,6 +1665,8 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) size = 0; } else { + if((to - from) == CURL_OFF_T_MAX) + return CURLE_RANGE_ERROR; size = to - from + 1; } diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index e9dfef950d..3a661f81eb 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -2544,6 +2544,8 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block) size = 0; } else { + if((to - from) == CURL_OFF_T_MAX) + return CURLE_RANGE_ERROR; size = to - from + 1; }