diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-07-06 23:25:21 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-07-06 23:25:21 +0000 |
commit | d5e275ddf4ee700053f028e2255d9b90fa885d18 (patch) | |
tree | aaca3e5d110d6a0b74c10a525c4ffcc8eacf982b /src/common | |
parent | fe099bc21ecbc5d3622e50ccca28bfdb085b53ab (diff) | |
download | tor-d5e275ddf4ee700053f028e2255d9b90fa885d18.tar.gz tor-d5e275ddf4ee700053f028e2255d9b90fa885d18.zip |
Fix bug reported by peter palfrader: an empty address is unresolvable, but not an occasion for an assertion failure in a dnsworker.
svn:r2015
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c index 27d43337af..cc90495bec 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -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; + } if (tor_inet_aton(name, &iaddr)) { /* It's an IP. */ memcpy(addr, &iaddr.s_addr, 4); return 0; |