mirror of
https://github.com/curl/curl.git
synced 2026-07-09 00:17:15 +03:00
setopt: cleanup the length check for COPYPOSTFIELDS handling
Make it more straight-forward Closes #22127
This commit is contained in:
parent
c5d0e93879
commit
c35e2cb29f
1 changed files with 3 additions and 5 deletions
|
|
@ -1814,14 +1814,12 @@ static CURLcode setopt_cptr_proxy(struct Curl_easy *data, CURLoption option,
|
|||
static CURLcode setopt_copypostfields(const char *ptr, struct UserDefined *s)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
if(s->postfieldsize < -1)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
if(!ptr || s->postfieldsize == -1)
|
||||
result = Curl_setstropt(&s->str[STRING_COPYPOSTFIELDS], ptr);
|
||||
else {
|
||||
size_t pflen;
|
||||
|
||||
if(s->postfieldsize < 0)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
pflen = curlx_sotouz_range(s->postfieldsize, 0, SIZE_MAX);
|
||||
size_t pflen = curlx_sotouz_range(s->postfieldsize, 0, SIZE_MAX);
|
||||
if(pflen == SIZE_MAX)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue