diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-12 15:11:31 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-12 15:11:31 -0500 |
commit | 24add404ac08df59d0b5d68c6762b869bee63bac (patch) | |
tree | f0eac7362de7fa012eb89187efc30f09f6990dee /src | |
parent | 2c0088b8aa360c8dfa4c38c45d50542fa9aae8fb (diff) | |
download | tor-24add404ac08df59d0b5d68c6762b869bee63bac.tar tor-24add404ac08df59d0b5d68c6762b869bee63bac.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/ext/eventdns.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ext/eventdns.c b/src/ext/eventdns.c index 8b934c443..5ac9c1230 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) { |