]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urldata: make 'buffer_size' an unsigned int
authorDaniel Stenberg <daniel@haxx.se>
Mon, 4 Jul 2022 17:41:52 +0000 (19:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 4 Jul 2022 21:03:44 +0000 (23:03 +0200)
It is already capped at READBUFFER_MAX which fits easily in 32 bits.

Closes #9098

lib/pingpong.c
lib/setopt.c
lib/urldata.h
lib/vtls/vtls.c

index cd55173261bcca1e67db8d20e2ba5f7eb30999f0..74a678a1a42f8cdc593ef7ea9519dea8ed1025dd 100644 (file)
@@ -398,7 +398,8 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
       }
       else if(keepon) {
 
-        if((perline == gotbytes) && (gotbytes > data->set.buffer_size/2)) {
+        if((perline == gotbytes) &&
+           (gotbytes > (ssize_t)data->set.buffer_size/2)) {
           /* We got an excessive line without newlines and we need to deal
              with it. We keep the first bytes of the line then we throw
              away the rest. */
index bb0e700fbcfa22b374083802646327cf774672e4..ba36b495c18bb0b55de9cf9a957b21e2b1703346 100644 (file)
@@ -2238,7 +2238,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
     else if(arg < READBUFFER_MIN)
       arg = READBUFFER_MIN;
 
-    data->set.buffer_size = arg;
+    data->set.buffer_size = (int)arg;
     break;
 
   case CURLOPT_UPLOAD_BUFFERSIZE:
index 8c38bbd18c4bdfde23ae53476b32d0cd315e8c49..e8aa9304103928de10f62b25d2b9ecbcfc13c730 100644 (file)
@@ -1744,7 +1744,7 @@ struct UserDefined {
 #endif
   struct ssl_general_config general_ssl; /* general user defined SSL stuff */
   int dns_cache_timeout; /* DNS cache timeout (seconds) */
-  long buffer_size;      /* size of receive buffer to use */
+  unsigned int buffer_size;      /* size of receive buffer to use */
   unsigned int upload_buffer_size; /* size of upload buffer to use,
                                       keep it >= CURL_MAX_WRITE_SIZE */
   void *private_data; /* application-private data */
index faa1b51417da8fb32143f1f5aeaaf92c293698db..970ec92f92434b6184c91439174a21c5417deed1 100644 (file)
@@ -899,7 +899,7 @@ char *Curl_ssl_snihost(struct Curl_easy *data, const char *host, size_t *olen)
   size_t len = strlen(host);
   if(len && (host[len-1] == '.'))
     len--;
-  if((long)len >= data->set.buffer_size)
+  if(len >= data->set.buffer_size)
     return NULL;
 
   Curl_strntolower(data->state.buffer, host, len);