Commit ffe8afb9 authored by Mike Perry's avatar Mike Perry
Browse files

fixup! Implement congestion control parameter negotiation

Fix ssize_t misuse
parent fc58c91b
......@@ -233,6 +233,7 @@ negotiate_v3_ntor_server_circ_params(const uint8_t *param_request_msg,
{
circ_params_response_t resp = {0};
circ_params_request_t *param_request = NULL;
ssize_t resp_msg_len;
if (circ_params_request_parse(&param_request, param_request_msg,
param_request_len) < 0) {
......@@ -264,16 +265,24 @@ negotiate_v3_ntor_server_circ_params(const uint8_t *param_request_msg,
return -1;
}
*resp_msg_len_out = circ_params_response_encoded_len(&resp);
*resp_msg_out = tor_malloc_zero(*resp_msg_len_out);
resp_msg_len = circ_params_response_encoded_len(&resp);
if (circ_params_response_encode(*resp_msg_out, *resp_msg_len_out, &resp)
< 0) {
if (resp_msg_len < 0) {
tor_free(param_request);
return -1;
}
*resp_msg_out = tor_malloc_zero(resp_msg_len);
resp_msg_len = circ_params_response_encode(*resp_msg_out, resp_msg_len, &resp);
if (resp_msg_len < 0) {
tor_free(param_request);
tor_free(*resp_msg_out);
return -1;
}
*resp_msg_len_out = (size_t)resp_msg_len;
tor_free(param_request);
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment