]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh/libssh2: return error on too big range
authorDaniel Stenberg <daniel@haxx.se>
Sat, 24 Feb 2024 21:38:22 +0000 (22:38 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 25 Feb 2024 21:40:39 +0000 (22:40 +0100)
If trying to get the range 0 - 2^63 and the remote file is 2^63 bytes or
larger.

Fixes #12983
Closes #12984

lib/vssh/libssh.c
lib/vssh/libssh2.c

index c6dc63ae66f9743b8f2cc560b765b6aae9f80dfd..02148d0c1873d840ff390ad646ff59305ee1c670 100644 (file)
@@ -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;
           }
 
index e9dfef950d856abc9c57081aec934ee2ae4d9314..3a661f81eb2f2fc5189c885b059fa6c4ff3dc331 100644 (file)
@@ -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;
           }