]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: refuse POSTFIELDS + RESUME_FROM combo
authorDaniel Stenberg <daniel@haxx.se>
Sun, 7 May 2023 22:12:25 +0000 (00:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 8 May 2023 12:10:34 +0000 (14:10 +0200)
The code assumes that such a resume is wanting to continue an upload
using the read callback, and since POSTFIELDS is done without callback
libcurl will just misbehave.

This combo will make the transfer fail with CURLE_BAD_FUNCTION_ARGUMENT
with an explanation in the error message.

Reported-by: Smackd0wn on github
Fixes #11081
Closes #11083

lib/transfer.c

index 947070956d24a3201e8ece09bf4ea37a1f99a154..d2ff0c24c2d509a569b082501a7894cd77c86ef0 100644 (file)
@@ -1325,6 +1325,12 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
     }
   }
 
+  if(data->set.postfields && data->set.set_resume_from) {
+    /* we can't */
+    failf(data, "cannot mix POSTFIELDS with RESUME_FROM");
+    return CURLE_BAD_FUNCTION_ARGUMENT;
+  }
+
   data->state.prefer_ascii = data->set.prefer_ascii;
   data->state.list_only = data->set.list_only;
   data->state.httpreq = data->set.method;