]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
eventdns.c: survive broken resolv.conf files
authorNick Mathewson <nickm@torproject.org>
Wed, 12 Feb 2014 20:11:31 +0000 (15:11 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 12 Feb 2014 20:11:31 +0000 (15:11 -0500)
If you had a resolv.conf file with a nameserver line containing no
nameserver IP, we would crash.  That's not terrible, but it's not
desirable.

Fixes bug 8788; bugfix on 0.1.1.23.  Libevent already has this fix.

changes/bug8788 [new file with mode: 0644]
src/ext/eventdns.c

diff --git a/changes/bug8788 b/changes/bug8788
new file mode 100644 (file)
index 0000000..26fb5bc
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes:
+    - Avoid crashing on a malformed resolv.conf file when running a
+      server using Libevent 1. Fixes bug 8788; bugfix on 0.1.1.23.
index 8b934c4430439e2449b203571ac3af4d2c09f302..5ac9c1230ce4028b9987f2b0d56d7922fc222b2b 100644 (file)
@@ -3014,7 +3014,8 @@ resolv_conf_parse_line(char *const start, int flags) {
 
        if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {
                const char *const nameserver = NEXT_TOKEN;
-               evdns_nameserver_ip_add(nameserver);
+               if (nameserver)
+                       evdns_nameserver_ip_add(nameserver);
        } else if (!strcmp(first_token, "domain") && (flags & DNS_OPTION_SEARCH)) {
                const char *const domain = NEXT_TOKEN;
                if (domain) {