mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
multi_runsingle: added precaution against easy_conn NULL pointer
In many states the easy_conn pointer is referenced and just assumed to be working. This is an added extra check since analyzing indicates there's a risk we can end up in these states with a NULL pointer there.
This commit is contained in:
parent
ff318a6302
commit
9d11716933
10
lib/multi.c
10
lib/multi.c
@ -984,6 +984,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!easy->easy_conn &&
|
||||||
|
easy->state > CURLM_STATE_CONNECT &&
|
||||||
|
easy->state < CURLM_STATE_DONE) {
|
||||||
|
/* In all these states, the code will blindly access 'easy->easy_conn'
|
||||||
|
so this is precaution that it isn't NULL. And it silences static
|
||||||
|
analyzers. */
|
||||||
|
failf(data, "In state %d with no easy_conn, bail out!\n", easy->state);
|
||||||
|
return CURLM_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT &&
|
if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT &&
|
||||||
easy->state < CURLM_STATE_COMPLETED)
|
easy->state < CURLM_STATE_COMPLETED)
|
||||||
/* Make sure we set the connection's current owner */
|
/* Make sure we set the connection's current owner */
|
||||||
|
Loading…
Reference in New Issue
Block a user