summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
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;