← Commit list

c35e2cb29f

Daniel Stenberg
Daniel Stenberg
2026-06-22
SUCCESS Duration: 171s

Subject

setopt: cleanup the length check for COPYPOSTFIELDS handling

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/setopt.c+3 -5
@@ -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 {