Skip to content

Commit

Permalink
hostip: fix crash in sync resolver builds that use DOH
Browse files Browse the repository at this point in the history
- Guard some Curl_async accesses with USE_CURL_ASYNC instead of
  !CURLRES_SYNCH.

This is another follow-up to 8335c64 which moved the async struct from
the connectdata struct into the Curl_easy struct. A previous follow-up
6cd167a fixed building for sync resolver by guarding some async struct
accesses with !CURLRES_SYNCH. The problem is since DOH (DNS-over-HTTPS)
is available as an asynchronous secondary resolver the async struct may
be used even when libcurl is built for the sync resolver. That means
that CURLRES_SYNCH and USE_CURL_ASYNC may be defined at the same time.

Closes #6603
  • Loading branch information
jay committed Feb 14, 2021
1 parent 835c263 commit b68026f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/hostip.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,10 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
int st;
Curl_set_in_callback(data, true);
st = data->set.resolver_start(
#ifdef CURLRES_SYNCH
NULL,
#else
#ifdef USE_CURL_ASYNC
data->state.async.resolver,
#else
NULL,
#endif
NULL,
data->set.resolver_start_client);
Expand Down Expand Up @@ -1108,7 +1108,7 @@ CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_done)
CURLcode result;
struct connectdata *conn = data->conn;

#ifndef CURLRES_SYNCH
#ifdef USE_CURL_ASYNC
if(data->state.async.dns) {
conn->dns_entry = data->state.async.dns;
data->state.async.dns = NULL;
Expand Down

0 comments on commit b68026f

Please sign in to comment.