aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-08-24 04:51:55 +0000
committerRoger Dingledine <arma@torproject.org>2006-08-24 04:51:55 +0000
commit0649fa14c1618fe98116dfc07d921f89f23d968e (patch)
tree58dab72ce946207b72cdfec9673f4a7c2b906854
parent9ebaf01096699aa3cf3aa95532b375f93ebc8e2e (diff)
downloadtor-0649fa14c1618fe98116dfc07d921f89f23d968e.tar
tor-0649fa14c1618fe98116dfc07d921f89f23d968e.tar.gz
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. svn:r8223
-rw-r--r--src/or/buffers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 69cfd30d3..20fa700a0 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -953,7 +953,9 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
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 */