]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pop3: function could get the ->transfer field wrong
authorDaniel Stenberg <daniel@haxx.se>
Mon, 13 Oct 2025 06:41:38 +0000 (08:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 13 Oct 2025 08:40:48 +0000 (10:40 +0200)
In pop3_perform(), pop3->transfer was derived from the old
data->req.no_body. Then, pop3_perform_command() re-computed
data->req.no_body.

Now we instead call pop3_perform_command() first.

Reported-by: Joshua Rogers
Closes #19039

lib/pop3.c

index dbcc2d198df26bdc9c32f6599c5703e7e1c06356..a0fd881a791f6a1da59add40fa25031d77aee83b 100644 (file)
@@ -1377,18 +1377,17 @@ static CURLcode pop3_perform(struct Curl_easy *data, bool *connected,
 
   DEBUGF(infof(data, "DO phase starts"));
 
-  if(data->req.no_body) {
+  /* Start the first command in the DO phase, may alter data->req.no_body */
+  result = pop3_perform_command(data);
+  if(result)
+    return result;
+
+  if(data->req.no_body)
     /* Requested no body means no transfer */
     pop3->transfer = PPTRANSFER_INFO;
-  }
 
   *dophase_done = FALSE; /* not done yet */
 
-  /* Start the first command in the DO phase */
-  result = pop3_perform_command(data);
-  if(result)
-    return result;
-
   /* Run the state-machine */
   result = pop3_multi_statemach(data, dophase_done);
   *connected = Curl_conn_is_connected(data->conn, FIRSTSOCKET);