urldata: make 'buffer_size' an unsigned int

It is already capped at READBUFFER_MAX which fits easily in 32 bits.

Closes #9098
This commit is contained in:
Daniel Stenberg 2022-07-04 19:41:52 +02:00
parent cb17b12b01
commit 3fa343a35c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 5 additions and 4 deletions

View File

@ -398,7 +398,8 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
} }
else if(keepon) { 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 /* 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 with it. We keep the first bytes of the line then we throw
away the rest. */ away the rest. */

View File

@ -2238,7 +2238,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
else if(arg < READBUFFER_MIN) else if(arg < READBUFFER_MIN)
arg = READBUFFER_MIN; arg = READBUFFER_MIN;
data->set.buffer_size = arg; data->set.buffer_size = (int)arg;
break; break;
case CURLOPT_UPLOAD_BUFFERSIZE: case CURLOPT_UPLOAD_BUFFERSIZE:

View File

@ -1744,7 +1744,7 @@ struct UserDefined {
#endif #endif
struct ssl_general_config general_ssl; /* general user defined SSL stuff */ struct ssl_general_config general_ssl; /* general user defined SSL stuff */
int dns_cache_timeout; /* DNS cache timeout (seconds) */ 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, unsigned int upload_buffer_size; /* size of upload buffer to use,
keep it >= CURL_MAX_WRITE_SIZE */ keep it >= CURL_MAX_WRITE_SIZE */
void *private_data; /* application-private data */ void *private_data; /* application-private data */

View File

@ -899,7 +899,7 @@ char *Curl_ssl_snihost(struct Curl_easy *data, const char *host, size_t *olen)
size_t len = strlen(host); size_t len = strlen(host);
if(len && (host[len-1] == '.')) if(len && (host[len-1] == '.'))
len--; len--;
if((long)len >= data->set.buffer_size) if(len >= data->set.buffer_size)
return NULL; return NULL;
Curl_strntolower(data->state.buffer, host, len); Curl_strntolower(data->state.buffer, host, len);