aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-11-04 00:48:25 -0500
committerNick Mathewson <nickm@torproject.org>2014-11-04 00:48:25 -0500
commit60c86a3b79d542543f191a78f5c7ea2c77c0d3f0 (patch)
treef24602f15430925d2449054d2f5fae025936d41c /src/or/buffers.c
parent593909ea70db9c00d3ae6d3448fb096464e0853d (diff)
parent74cbd8d55953969c15c60f025889b1e07a185a79 (diff)
downloadtor-60c86a3b79d542543f191a78f5c7ea2c77c0d3f0.tar.gz
tor-60c86a3b79d542543f191a78f5c7ea2c77c0d3f0.zip
Merge branch 'bug13315_squashed'
Conflicts: src/or/buffers.c
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 080d8fb6c7..bd33fe451d 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -2054,8 +2054,20 @@ parse_socks(const char *data, size_t datalen, socks_request_t *req,
req->address[len] = 0;
req->port = ntohs(get_uint16(data+5+len));
*drain_out = 5+len+2;
- if (!tor_strisprint(req->address) || strchr(req->address,'\"')) {
+
+ if (string_is_valid_ipv4_address(req->address) ||
+ string_is_valid_ipv6_address(req->address)) {
+ log_unsafe_socks_warning(5,req->address,req->port,safe_socks);
+
+ if (safe_socks) {
+ socks_request_set_socks5_error(req, SOCKS5_NOT_ALLOWED);
+ return -1;
+ }
+ }
+
+ if (!string_is_valid_hostname(req->address)) {
socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR);
+
log_warn(LD_PROTOCOL,
"Your application (using socks5 to port %d) gave Tor "
"a malformed hostname: %s. Rejecting the connection.",