From: Nick Mathewson Date: Wed, 12 Feb 2014 20:11:31 +0000 (-0500) Subject: eventdns.c: survive broken resolv.conf files X-Git-Tag: tor-0.2.5.3-alpha~35^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24add404ac08df59d0b5d68c6762b869bee63bac;p=thirdparty%2Ftor.git eventdns.c: survive broken resolv.conf files 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. --- diff --git a/changes/bug8788 b/changes/bug8788 new file mode 100644 index 0000000000..26fb5bc4f3 --- /dev/null +++ b/changes/bug8788 @@ -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. diff --git a/src/ext/eventdns.c b/src/ext/eventdns.c index 8b934c4430..5ac9c1230c 100644 --- a/src/ext/eventdns.c +++ b/src/ext/eventdns.c @@ -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) {