[or-cvs] avoid infinite loop in tor-resolve if tor hangs up on it

Roger Dingledine arma at seul.org
Wed Nov 24 07:45:51 UTC 2004


Update of /home2/or/cvsroot/tor/src/tools
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/tools

Modified Files:
	tor-resolve.c 
Log Message:
avoid infinite loop in tor-resolve if tor hangs up on it


Index: tor-resolve.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/tools/tor-resolve.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- tor-resolve.c	14 Nov 2004 18:14:15 -0000	1.6
+++ tor-resolve.c	24 Nov 2004 07:45:42 -0000	1.7
@@ -137,6 +137,10 @@
   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;



More information about the tor-commits mailing list