]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: avoid unreachable expression
authorDaniel Stenberg <daniel@haxx.se>
Tue, 21 Nov 2023 07:13:08 +0000 (08:13 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 21 Nov 2023 12:51:22 +0000 (13:51 +0100)
If curl_off_t and size_t have the same size (which is common on modern
64 bit systems), a condition cannot occur which Coverity pointed
out. Avoid the warning by having the code conditionally only used if
curl_off_t actually is larger.

Follow-up to 1cd2f0072fa482e25baa2

Closes #12370

lib/transfer.c

index a4aae128252e6e9c5e3f24c4eb6215c7fe0a4387..fa7f97ec69b5bd2a8e48958297f15044f12f5a7e 100644 (file)
@@ -423,9 +423,11 @@ static size_t get_max_body_write_len(struct Curl_easy *data)
       /* already written too much! */
       return 0;
     }
+#if SIZEOF_CURL_OFF_T > SIZEOF_SIZE_T
     else if(remain_diff > SSIZE_T_MAX) {
       return SIZE_T_MAX;
     }
+#endif
     else {
       return (size_t)remain_diff;
     }