commit 04a5f2d99dd7196289ad225bb0c674e51a84ceaf Author: David Goulet dgoulet@ev0ke.net Date: Sun Jun 23 15:02:31 2013 -0400
Fix: set maximum possible buffer in SOCKS5 resolve req.
Signed-off-by: David Goulet dgoulet@ev0ke.net --- src/common/socks5.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/common/socks5.c b/src/common/socks5.c index fcb30d7..e06528a 100644 --- a/src/common/socks5.c +++ b/src/common/socks5.c @@ -394,8 +394,11 @@ error: int socks5_send_resolve_request(const char *hostname, struct connection *conn) { int ret, ret_send; - /* Buffer to send won't go over a full TCP size. */ - char buffer[1500]; + /* + * Can't go bigger than that. 4 bytes for the header, 1 for the name len + * and 255 for the name. + */ + char buffer[260]; size_t name_len, msg_len, data_len; struct socks5_request msg; struct socks5_request_resolve req;
tor-commits@lists.torproject.org