diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2020-08-19 08:16:34 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2020-08-19 08:16:34 +0200 |
commit | cc0d53905ce9306b51bace2682ae3d1d122c7881 (patch) | |
tree | 4148a8ae05f9fd36bc59e9537d760b36845f700e | |
parent | common: Fix iobuf.c. (diff) | |
download | gnupg2-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.c | 6 |
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); |