mirror of
https://github.com/curl/curl.git
synced 2026-08-26 19:43:32 +03:00
multi: Change curl_multi_wait/poll to error on negative timeout
- Add new error CURLM_BAD_FUNCTION_ARGUMENT and return that error when curl_multi_wait/poll is passed timeout param < 0. Prior to this change passing a negative value to curl_multi_wait/poll such as -1 could cause the function to wait forever. Reported-by: hamstergene@users.noreply.github.com Fixes https://github.com/curl/curl/issues/4763 Closes https://github.com/curl/curl/pull/4765
This commit is contained in:
parent
ea6d6205d9
commit
b700662b1c
7 changed files with 17 additions and 4 deletions
|
|
@ -1048,6 +1048,9 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
|
|||
if(multi->in_callback)
|
||||
return CURLM_RECURSIVE_API_CALL;
|
||||
|
||||
if(timeout_ms < 0)
|
||||
return CURLM_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
/* Count up how many fds we have from the multi handle */
|
||||
data = multi->easyp;
|
||||
while(data) {
|
||||
|
|
|
|||
|
|
@ -392,6 +392,9 @@ curl_multi_strerror(CURLMcode error)
|
|||
case CURLM_WAKEUP_FAILURE:
|
||||
return "Wakeup is unavailable or failed";
|
||||
|
||||
case CURLM_BAD_FUNCTION_ARGUMENT:
|
||||
return "A libcurl function was given a bad argument";
|
||||
|
||||
case CURLM_LAST:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue