aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-11-24 07:45:42 +0000
committerRoger Dingledine <arma@torproject.org>2004-11-24 07:45:42 +0000
commitc89afb791705aa86828b9d407fa744ed9312a0ac (patch)
treec2049e0ef1a78f3510d29806733d5a7835040ad5 /src/tools
parent6be64e7fbd2eb2b8cea996594b6c70f29e70e585 (diff)
downloadtor-c89afb791705aa86828b9d407fa744ed9312a0ac.tar
tor-c89afb791705aa86828b9d407fa744ed9312a0ac.tar.gz
avoid infinite loop in tor-resolve if tor hangs up on it
svn:r2977
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tor-resolve.c4
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;