diff options
author | David Goulet <dgoulet@torproject.org> | 2020-12-15 11:58:13 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-12-15 11:58:13 -0500 |
commit | 4a77aa6e8248f06e17a9a7375076b9d685a6b789 (patch) | |
tree | 56b99178f251c6d9c03c514988c8e688779f9404 /src/core/proto | |
parent | c731a4efec3c7206bbbb8d2ba39c970fcb0c9f36 (diff) | |
parent | c4fe66e342292b45f29e9fd242b66a0ca27a7758 (diff) | |
download | tor-4a77aa6e8248f06e17a9a7375076b9d685a6b789.tar.gz tor-4a77aa6e8248f06e17a9a7375076b9d685a6b789.zip |
Merge branch 'tor-gitlab/mr/239' into maint-0.4.5
Diffstat (limited to 'src/core/proto')
-rw-r--r-- | src/core/proto/proto_socks.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/proto/proto_socks.c b/src/core/proto/proto_socks.c index ada968c6b4..a7ee190b3f 100644 --- a/src/core/proto/proto_socks.c +++ b/src/core/proto/proto_socks.c @@ -550,6 +550,7 @@ parse_socks5_client_request(const uint8_t *raw_data, socks_request_t *req, if (parsed == -1) { log_warn(LD_APP, "socks5: parsing failed - invalid client request"); res = SOCKS_RESULT_INVALID; + socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR); goto end; } else if (parsed == -2) { res = SOCKS_RESULT_TRUNCATED; @@ -561,6 +562,7 @@ parse_socks5_client_request(const uint8_t *raw_data, socks_request_t *req, if (socks5_client_request_get_version(trunnel_req) != 5) { res = SOCKS_RESULT_INVALID; + socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR); goto end; } @@ -594,6 +596,7 @@ parse_socks5_client_request(const uint8_t *raw_data, socks_request_t *req, tor_addr_to_str(req->address, &destaddr, sizeof(req->address), 1); } break; default: { + socks_request_set_socks5_error(req, SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED); res = -1; } break; } @@ -774,8 +777,10 @@ handle_socks_message(const uint8_t *raw_data, size_t datalen, } else { res = parse_socks5_client_request(raw_data, req, datalen, drain_out); - if (res != SOCKS_RESULT_DONE) { + if (BUG(res == SOCKS_RESULT_INVALID && req->replylen == 0)) { socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR); + } + if (res != SOCKS_RESULT_DONE) { goto end; } |