aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-10-04 12:13:06 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-10-04 23:22:28 +0200
commit8f2bb0e3779a7a6fe20ce4b892569d7565e6ac08 (patch)
tree658421c4b5ef8b47fd80b611cc8544a5856da29f /lib
parent94ad57b0246b5658c2a9139dbe6a80efa4c4e2f3 (diff)
doh: make sure TTL isn't re-inited by second (discarded?) response
Closes #3092
Diffstat (limited to 'lib')
-rw-r--r--lib/doh.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/doh.c b/lib/doh.c
index 03e28beae..178e474aa 100644
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -498,6 +498,13 @@ static DOHcode rdata(unsigned char *doh,
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,
size_t dohlen,
DNStype dnstype,
@@ -514,8 +521,6 @@ UNITTEST DOHcode doh_decode(unsigned char *doh,
unsigned int index = 12;
DOHcode rc;
- d->ttl = INT_MAX;
-
if(dohlen < 12)
return DOH_TOO_SMALL_BUFFER; /* too small */
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);
/* 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,
data->req.doh.probe[0].serverdoh.size,
data->req.doh.probe[0].dnstype,