mirror of
https://github.com/curl/curl.git
synced 2026-04-15 03:21:41 +03:00
transfer: Fix potential NULL pointer dereference
Commit 0ef54abf52 accidentally used the conn variable before the
assertion for it being NULL. Fix by moving the assignment which use
conn to after the assertion.
Closes: #8857
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
This commit is contained in:
parent
2df67e93c3
commit
542c78dda7
1 changed files with 5 additions and 2 deletions
|
|
@ -1896,11 +1896,14 @@ Curl_setup_transfer(
|
|||
struct SingleRequest *k = &data->req;
|
||||
struct connectdata *conn = data->conn;
|
||||
struct HTTP *http = data->req.p.http;
|
||||
bool httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
|
||||
(http->sending == HTTPSEND_REQUEST));
|
||||
bool httpsending;
|
||||
|
||||
DEBUGASSERT(conn != NULL);
|
||||
DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
|
||||
|
||||
httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
|
||||
(http->sending == HTTPSEND_REQUEST));
|
||||
|
||||
if(conn->bits.multiplex || conn->httpversion == 20 || httpsending) {
|
||||
/* when multiplexing, the read/write sockets need to be the same! */
|
||||
conn->sockfd = sockindex == -1 ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue