mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Merge branch 'maint-0.3.5' into maint-0.4.3
This commit is contained in:
commit
f058db1f3d
4
changes/bug40190
Normal file
4
changes/bug40190
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor bugfixes (SOCKS5):
|
||||||
|
- Handle partial socks5 messages correctly. Previously, our code would
|
||||||
|
send an incorrect error message if it got a socks5 request that wasn't
|
||||||
|
complete. Fixes bug 40190; bugfix on 0.3.5.1-alpha.
|
@ -550,6 +550,7 @@ parse_socks5_client_request(const uint8_t *raw_data, socks_request_t *req,
|
|||||||
if (parsed == -1) {
|
if (parsed == -1) {
|
||||||
log_warn(LD_APP, "socks5: parsing failed - invalid client request");
|
log_warn(LD_APP, "socks5: parsing failed - invalid client request");
|
||||||
res = SOCKS_RESULT_INVALID;
|
res = SOCKS_RESULT_INVALID;
|
||||||
|
socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR);
|
||||||
goto end;
|
goto end;
|
||||||
} else if (parsed == -2) {
|
} else if (parsed == -2) {
|
||||||
res = SOCKS_RESULT_TRUNCATED;
|
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) {
|
if (socks5_client_request_get_version(trunnel_req) != 5) {
|
||||||
res = SOCKS_RESULT_INVALID;
|
res = SOCKS_RESULT_INVALID;
|
||||||
|
socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,6 +597,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);
|
tor_addr_to_str(req->address, &destaddr, sizeof(req->address), 1);
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
socks_request_set_socks5_error(req, SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED);
|
||||||
res = -1;
|
res = -1;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
@ -775,8 +778,10 @@ handle_socks_message(const uint8_t *raw_data, size_t datalen,
|
|||||||
} else {
|
} else {
|
||||||
res = parse_socks5_client_request(raw_data, req,
|
res = parse_socks5_client_request(raw_data, req,
|
||||||
datalen, drain_out);
|
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);
|
socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR);
|
||||||
|
}
|
||||||
|
if (res != SOCKS_RESULT_DONE) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user