summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-08-19 08:16:34 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2020-08-19 08:16:34 +0200
commitcc0d53905ce9306b51bace2682ae3d1d122c7881 (patch)
tree4148a8ae05f9fd36bc59e9537d760b36845f700e
parentcommon: Fix iobuf.c. (diff)
downloadgnupg2-cc0d53905ce9306b51bace2682ae3d1d122c7881.tar.xz
gnupg2-cc0d53905ce9306b51bace2682ae3d1d122c7881.zip
dns: Fix memory use-after-free.
* dirmngr/dns.c (dns_res_stub): Fix RESCONF usage. -- Note that this is dead code. It is for making a static analyzer happy. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--dirmngr/dns.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
index 0ea6be3fb..3ac6a2d02 100644
--- a/dirmngr/dns.c
+++ b/dirmngr/dns.c
@@ -8301,8 +8301,14 @@ struct dns_resolver *dns_res_stub(const struct dns_options *opts, int *error) {
if (!(hints = dns_hints_local(resconf, error)))
goto epilog;
+ /* RESCONF is closed by dns_hints_local, so, get it again. */
+ if (!(resconf = dns_resconf_local(error)))
+ goto epilog;
+
if (!(res = dns_res_open(resconf, hosts, hints, NULL, opts, error)))
goto epilog;
+ else
+ return res;
epilog:
dns_resconf_close(resconf);