mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
doh: make sure TTL isn't re-inited by second (discarded?) response
Closes #3092
This commit is contained in:
parent
94ad57b024
commit
8f2bb0e377
11
lib/doh.c
11
lib/doh.c
@ -498,6 +498,13 @@ static DOHcode rdata(unsigned char *doh,
|
|||||||
return DOH_OK;
|
return DOH_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init_dohentry(struct dohentry *de)
|
||||||
|
{
|
||||||
|
memset(de, 0, sizeof(*de));
|
||||||
|
de->ttl = INT_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UNITTEST DOHcode doh_decode(unsigned char *doh,
|
UNITTEST DOHcode doh_decode(unsigned char *doh,
|
||||||
size_t dohlen,
|
size_t dohlen,
|
||||||
DNStype dnstype,
|
DNStype dnstype,
|
||||||
@ -514,8 +521,6 @@ UNITTEST DOHcode doh_decode(unsigned char *doh,
|
|||||||
unsigned int index = 12;
|
unsigned int index = 12;
|
||||||
DOHcode rc;
|
DOHcode rc;
|
||||||
|
|
||||||
d->ttl = INT_MAX;
|
|
||||||
|
|
||||||
if(dohlen < 12)
|
if(dohlen < 12)
|
||||||
return DOH_TOO_SMALL_BUFFER; /* too small */
|
return DOH_TOO_SMALL_BUFFER; /* too small */
|
||||||
if(doh[0] || doh[1])
|
if(doh[0] || doh[1])
|
||||||
@ -824,7 +829,7 @@ CURLcode Curl_doh_is_resolved(struct connectdata *conn,
|
|||||||
Curl_close(data->req.doh.probe[1].easy);
|
Curl_close(data->req.doh.probe[1].easy);
|
||||||
|
|
||||||
/* parse the responses, create the struct and return it! */
|
/* parse the responses, create the struct and return it! */
|
||||||
memset(&de, 0, sizeof(de));
|
init_dohentry(&de);
|
||||||
rc = doh_decode(data->req.doh.probe[0].serverdoh.memory,
|
rc = doh_decode(data->req.doh.probe[0].serverdoh.memory,
|
||||||
data->req.doh.probe[0].serverdoh.size,
|
data->req.doh.probe[0].serverdoh.size,
|
||||||
data->req.doh.probe[0].dnstype,
|
data->req.doh.probe[0].dnstype,
|
||||||
|
Loading…
Reference in New Issue
Block a user