]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: make CURLOPT_TFTP_BLKSIZE accept bad values
authorDaniel Stenberg <daniel@haxx.se>
Thu, 22 Aug 2024 13:55:09 +0000 (15:55 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 23 Aug 2024 06:24:33 +0000 (08:24 +0200)
... and just move them into the accepted range. Like how buffersize and
a few other options work.

Closes #14634

lib/setopt.c

index e8d7ada14e77da2425c001893bbc8ed59a4584fb..8832fca12646a1da5d6c6df6f448976a3286571a 100644 (file)
@@ -425,8 +425,10 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
      * TFTP option that specifies the block size to use for data transmission.
      */
     arg = va_arg(param, long);
-    if(arg > TFTP_BLKSIZE_MAX || arg < TFTP_BLKSIZE_MIN)
-      return CURLE_BAD_FUNCTION_ARGUMENT;
+    if(arg < TFTP_BLKSIZE_MIN)
+      arg = 512;
+    else if(arg > TFTP_BLKSIZE_MAX)
+      arg = TFTP_BLKSIZE_MAX;
     data->set.tftp_blksize = arg;
     break;
 #endif