From: Daniel Stenberg Date: Mon, 4 Aug 2025 20:25:29 +0000 (+0200) Subject: urldata: reduce two long struct fields to unsigned short X-Git-Tag: curl-8_16_0~255 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1f34125141aeab7d365b1e154ef0cd85393a9d30;p=thirdparty%2Fcurl.git urldata: reduce two long struct fields to unsigned short Closes #18173 --- diff --git a/lib/http.c b/lib/http.c index 08daab6dc9..6a7270c0d4 100644 --- a/lib/http.c +++ b/lib/http.c @@ -4785,7 +4785,7 @@ static CURLcode cr_exp100_read(struct Curl_easy *data, /* We are now waiting for a reply from the server or * a timeout on our side IFF the request has been fully sent. */ DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE, " - "timeout %ldms", data->set.expect_100_timeout)); + "timeout %dms", data->set.expect_100_timeout)); ctx->state = EXP100_AWAITING_CONTINUE; ctx->start = curlx_now(); Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT); diff --git a/lib/setopt.c b/lib/setopt.c index 394b5567e9..463b7f8407 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -919,7 +919,7 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option, arg = 512; else if(arg > TFTP_BLKSIZE_MAX) arg = TFTP_BLKSIZE_MAX; - s->tftp_blksize = arg; + s->tftp_blksize = (unsigned short)arg; break; #endif #ifndef CURL_DISABLE_NETRC @@ -1027,7 +1027,9 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option, */ if(arg < 0) return CURLE_BAD_FUNCTION_ARGUMENT; - s->expect_100_timeout = arg; + if(arg > 0xffff) + arg = 0xffff; + s->expect_100_timeout = (unsigned short)arg; break; #endif /* ! CURL_DISABLE_HTTP */ diff --git a/lib/urldata.h b/lib/urldata.h index ea31d9f5c8..789727db0c 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1388,9 +1388,6 @@ struct UserDefined { is to be reused */ timediff_t conn_max_age_ms; /* max time since creation to allow a connection that is to be reused */ -#ifndef CURL_DISABLE_TFTP - long tftp_blksize; /* in bytes, 0 means use default */ -#endif curl_off_t filesize; /* size of file to upload, -1 means unknown */ long low_speed_limit; /* bytes/second */ long low_speed_time; /* number of seconds */ @@ -1485,7 +1482,6 @@ struct UserDefined { int tcp_keepintvl; /* seconds between TCP keepalive probes */ int tcp_keepcnt; /* maximum number of keepalive probes */ - long expect_100_timeout; /* in milliseconds */ #if defined(USE_HTTP2) || defined(USE_HTTP3) struct Curl_data_priority priority; #endif @@ -1505,6 +1501,7 @@ struct UserDefined { #ifdef USE_ECH int tls_ech; /* TLS ECH configuration */ #endif + unsigned short expect_100_timeout; /* in milliseconds */ unsigned short use_port; /* which port to use (when not using default) */ #ifndef CURL_DISABLE_BINDLOCAL unsigned short localport; /* local port number to bind to */ @@ -1512,6 +1509,9 @@ struct UserDefined { in case the 'localport' one cannot be bind()ed */ #endif +#ifndef CURL_DISABLE_TFTP + unsigned short tftp_blksize; /* in bytes, 0 means use default */ +#endif #ifndef CURL_DISABLE_NETRC unsigned char use_netrc; /* enum CURL_NETRC_OPTION values */ #endif