diff options
author | User Sg <sg@masterappliance-current-fb13-sg.intranet> | 2021-07-13 17:47:04 +0000 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2021-07-16 14:17:47 -0400 |
commit | 6a66f72829fd43664960ee2bd6789c18ddea9702 (patch) | |
tree | 6ce81b91cf8990445ededcb9a55508176005538b | |
parent | b45d6e2c6a7ba8febab8358815e55e6c09f43855 (diff) | |
download | curl-6a66f72829fd43664960ee2bd6789c18ddea9702.tar.gz |
multi: fix crash in curl_multi_wait / curl_multi_poll
Appears to have been caused by 51c0ebc (precedes 7.77.0) which added a
VALID_SOCK check to one of the loops through the sockets but not the
other.
Reported-by: sylgal@users.noreply.github.com
Authored-by: sylgal@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/7379
Closes https://github.com/curl/curl/pull/7389
-rw-r--r-- | lib/multi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/multi.c b/lib/multi.c index 2a2d348b6..82d538d00 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1180,7 +1180,7 @@ static CURLMcode multi_wait(struct Curl_multi *multi, #ifdef USE_WINSOCK long mask = 0; #endif - if(bitmap & GETSOCK_READSOCK(i)) { + if((bitmap & GETSOCK_READSOCK(i)) && VALID_SOCK((sockbunch[i]))) { s = sockbunch[i]; #ifdef USE_WINSOCK mask |= FD_READ|FD_ACCEPT|FD_CLOSE; @@ -1189,7 +1189,7 @@ static CURLMcode multi_wait(struct Curl_multi *multi, ufds[nfds].events = POLLIN; ++nfds; } - if(bitmap & GETSOCK_WRITESOCK(i)) { + if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK((sockbunch[i]))) { s = sockbunch[i]; #ifdef USE_WINSOCK mask |= FD_WRITE|FD_CONNECT|FD_CLOSE; |