curl_easy_pause: set "in callback" true on exit if true

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
This commit is contained in:
Daniel Stenberg 2023-10-08 10:39:39 +02:00
parent 0e4bef0862
commit dc4e885f35
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View 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;
}