backport: Stop dnsworkers from triggering an assert failure when you

ask them to resolve the host "".


svn:r2227
This commit is contained in:
Roger Dingledine
2004-08-12 06:27:11 +00:00
parent 4a5f77839e
commit 632c3f8d56
4 changed files with 11 additions and 4 deletions
+5
View File
@@ -1,3 +1,8 @@
Changes in version 0.0.7.3 - 2004-08-12
o Stop dnsworkers from triggering an assert failure when you
ask them to resolve the host "".
Changes in version 0.0.7.2 - 2004-07-07
o A better fix for the 0.0.0.0 problem, that will hopefully
eliminate the remaining related assertion failures.
+1 -1
View File
@@ -1,6 +1,6 @@
AC_INIT
AM_INIT_AUTOMAKE(tor, 0.0.7.2)
AM_INIT_AUTOMAKE(tor, 0.0.7.3)
AM_CONFIG_HEADER(orconfig.h)
AC_CANONICAL_HOST
+4 -1
View File
@@ -1709,7 +1709,10 @@ int tor_lookup_hostname(const char *name, uint32_t *addr)
struct in_addr iaddr;
struct hostent *ent;
tor_assert(addr);
if (tor_inet_aton(name, &iaddr)) {
if (!*name) {
/* Empty address is an error. */
return -1;
} else if (tor_inet_aton(name, &iaddr)) {
/* It's an IP. */
memcpy(addr, &iaddr.s_addr, 4);
return 0;
+1 -2
View File
@@ -599,9 +599,8 @@ static int dnsworker_main(void *data) {
log_fn(LOG_INFO,"dnsworker exiting because tor process died.");
spawn_exit();
}
tor_assert(address_len > 0);
if(read_all(fd, address, address_len, 1) != address_len) {
if(address_len && read_all(fd, address, address_len, 1) != address_len) {
log_fn(LOG_ERR,"read hostname failed. Child exiting.");
spawn_exit();
}