summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-07-06 23:25:21 +0000
committerNick Mathewson <nickm@torproject.org>2004-07-06 23:25:21 +0000
commitd5e275ddf4ee700053f028e2255d9b90fa885d18 (patch)
treeaaca3e5d110d6a0b74c10a525c4ffcc8eacf982b /src/common
parentfe099bc21ecbc5d3622e50ccca28bfdb085b53ab (diff)
downloadtor-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.c5
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;