[tor-commits] [tor/master] Merge branch 'bug13315_squashed'

nickm at torproject.org nickm at torproject.org
Tue Nov 4 05:49:36 UTC 2014


commit 60c86a3b79d542543f191a78f5c7ea2c77c0d3f0
Merge: 593909e 74cbd8d
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Nov 4 00:48:25 2014 -0500

    Merge branch 'bug13315_squashed'
    
    Conflicts:
    	src/or/buffers.c

 changes/bug13315      |    5 ++++
 src/common/util.c     |   62 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/common/util.h     |    3 +++
 src/or/buffers.c      |   14 ++++++++++-
 src/test/test_socks.c |   36 ++++++++++++++++++++++++++++
 src/test/test_util.c  |   48 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 167 insertions(+), 1 deletion(-)

diff --cc src/or/buffers.c
index 080d8fb,691845e..bd33fe4
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@@ -2054,8 -2048,18 +2054,20 @@@ parse_socks(const char *data, size_t da
            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.",



More information about the tor-commits mailing list