diff options
author | Roger Dingledine <arma@torproject.org> | 2004-11-24 07:45:42 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-11-24 07:45:42 +0000 |
commit | c89afb791705aa86828b9d407fa744ed9312a0ac (patch) | |
tree | c2049e0ef1a78f3510d29806733d5a7835040ad5 | |
parent | 6be64e7fbd2eb2b8cea996594b6c70f29e70e585 (diff) | |
download | tor-c89afb791705aa86828b9d407fa744ed9312a0ac.tar tor-c89afb791705aa86828b9d407fa744ed9312a0ac.tar.gz |
avoid infinite loop in tor-resolve if tor hangs up on it
svn:r2977
-rw-r--r-- | src/tools/tor-resolve.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c index 5481ad0c4..40fd749d6 100644 --- a/src/tools/tor-resolve.c +++ b/src/tools/tor-resolve.c @@ -137,6 +137,10 @@ do_resolve(const char *hostname, uint32_t sockshost, uint16_t socksport, len = 0; while (len < RESPONSE_LEN) { r = recv(s, response_buf+len, RESPONSE_LEN-len, 0); + if (r==0) { + log_fn(LOG_WARN,"EOF while reading SOCKS response"); + return -1; + } if (r<0) { log_sock_error("reading SOCKS response", s); return -1; |