]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
doh: make Curl_doh_is_resolved survive a NULL pointer
authorDaniel Stenberg <daniel@haxx.se>
Thu, 21 Jan 2021 22:31:19 +0000 (23:31 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Jan 2021 22:31:19 +0000 (23:31 +0100)
... if Curl_doh() returned a NULL, this function gets called anyway as
in a asynch procedure. Then the doh struct pointer is NULL and signifies
an OOM situation.

Follow-up to 6246a1d8c6776

lib/doh.c

index f9feabacc064b0b6cffa62feb83fbe0ede78c657..608f3d94c45e029aaab76dc28afe9d0dcd4eff53 100644 (file)
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -918,6 +918,8 @@ CURLcode Curl_doh_is_resolved(struct connectdata *conn,
   struct Curl_easy *data = conn->data;
   struct dohdata *dohp = data->req.doh;
   *dnsp = NULL; /* defaults to no response */
+  if(!dohp)
+    return CURLE_OUT_OF_MEMORY;
 
   if(!dohp->probe[DOH_PROBE_SLOT_IPADDR_V4].easy &&
      !dohp->probe[DOH_PROBE_SLOT_IPADDR_V6].easy) {