]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urldata: reduce two long struct fields to unsigned short
authorDaniel Stenberg <daniel@haxx.se>
Mon, 4 Aug 2025 20:25:29 +0000 (22:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 5 Aug 2025 06:48:07 +0000 (08:48 +0200)
Closes #18173

lib/http.c
lib/setopt.c
lib/urldata.h

index 08daab6dc900a297fd5879c22480afb1625c82c5..6a7270c0d41935e6b976d28a304b3809dd0f4e4d 100644 (file)
@@ -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);
index 394b5567e9a1ba8e9569aca1fa3e3a92e6c4b50c..463b7f840796cac5957f7e6ac4592321e3cbba3e 100644 (file)
@@ -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 */
index ea31d9f5c80a3c139921a3ee50318ed4387c9eaf..789727db0cbb1c38b462e27c1bae7374d8efaefb 100644 (file)
@@ -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