[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8223: make our socks5 handling more robust to broken socks clients (tor/trunk/src/or)



Author: arma
Date: 2006-08-24 00:51:55 -0400 (Thu, 24 Aug 2006)
New Revision: 8223

Modified:
   tor/trunk/src/or/buffers.c
Log:
make our socks5 handling more robust to broken socks clients:
throw out everything waiting on the buffer in between socks
handshake phases, since they can't possibly (so the theory
goes) have predicted what we plan to respond to them.


Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c	2006-08-24 00:54:18 UTC (rev 8222)
+++ tor/trunk/src/or/buffers.c	2006-08-24 04:51:55 UTC (rev 8223)
@@ -953,7 +953,9 @@
           req->reply[1] = '\xFF'; /* reject all methods */
           return -1;
         }
-        buf_remove_from_front(buf,2+nummethods); /* remove packet from buf */
+        /* remove packet from buf. also remove any other extraneous
+         * bytes, to support broken socks clients. */
+        buf_clear(buf);
 
         req->replylen = 2; /* 2 bytes of response */
         req->reply[0] = 5; /* socks5 reply */