From: Daniel Stenberg Date: Thu, 22 Aug 2024 13:55:09 +0000 (+0200) Subject: setopt: make CURLOPT_TFTP_BLKSIZE accept bad values X-Git-Tag: curl-8_10_0~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17dde53968114080f078afb9acccbe27c044bf4b;p=thirdparty%2Fcurl.git setopt: make CURLOPT_TFTP_BLKSIZE accept bad values ... and just move them into the accepted range. Like how buffersize and a few other options work. Closes #14634 --- diff --git a/lib/setopt.c b/lib/setopt.c index e8d7ada14e..8832fca126 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -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