]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl_easy_pause: set "in callback" true on exit if true
authorDaniel Stenberg <daniel@haxx.se>
Sun, 8 Oct 2023 08:39:39 +0000 (10:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 9 Oct 2023 06:21:51 +0000 (08:21 +0200)
Because it might have called another callback in the mean time that then
set the bit FALSE on exit.

Reported-by: Jay Satiro
Fixes #12059
Closes #12061

lib/easy.c

index e0bde371f852581b8529409e5434201fe49b2e98..6b4fb8efeb171f012526968462b3d073a3cdfa8b 100644 (file)
@@ -1083,11 +1083,14 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
   CURLcode result = CURLE_OK;
   int oldstate;
   int newstate;
+  bool recursive = FALSE;
 
   if(!GOOD_EASY_HANDLE(data) || !data->conn)
     /* crazy input, don't continue */
     return CURLE_BAD_FUNCTION_ARGUMENT;
 
+  if(Curl_is_in_callback(data))
+    recursive = TRUE;
   k = &data->req;
   oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
 
@@ -1154,6 +1157,11 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
        corresponding socket callback, if used */
     result = Curl_updatesocket(data);
 
+  if(recursive)
+    /* this might have called a callback recursively which might have set this
+       to false again on exit */
+    Curl_set_in_callback(data, TRUE);
+
   return result;
 }