]> granicus.if.org Git - libevent/commitdiff
evdns: handle NULL filename explicitly
authorBogdan Harjoc <bharjoc@bitdefender.com>
Thu, 9 Aug 2018 10:04:52 +0000 (13:04 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 21 Oct 2018 11:28:59 +0000 (14:28 +0300)
Otherwise we will try to open NULL filename and got EFAULT and anyway
will got the same return code from evdns_base_resolv_conf_parse_impl()

Closes: #680 (cherry-picked)
evdns.c

diff --git a/evdns.c b/evdns.c
index a3f1226aeeeab3ddd8f968a476a1c4bdd3ee1ea0..582096267698e958a994b2ac2452aebb36b8202f 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -3623,6 +3623,11 @@ evdns_base_resolv_conf_parse_impl(struct evdns_base *base, int flags, const char
                        mm_free(fname);
        }
 
+       if (!filename) {
+               evdns_resolv_set_defaults(base, flags);
+               return 1;
+       }
+
        if ((err = evutil_read_file_(filename, &resolv, &n, 0)) < 0) {
                if (err == -1) {
                        /* No file. */