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

fixup! Hook up client usage of congestion control negotiation

Fix an assert and ssize_t misuse
parent bc44e6f5
......@@ -2604,8 +2604,10 @@ client_circ_negotiation_message(const extend_info_t *ei,
uint8_t **msg_out,
size_t *msg_len_out)
{
tor_assert(ei && !msg_out && !msg_len_out);
circ_params_request_t params;
tor_assert(ei && msg_out && msg_len_out);
circ_params_request_t params = {0};
ssize_t msg_len = 0;
if (! ei->exit_supports_congestion_control)
return -1;
......@@ -2614,20 +2616,22 @@ client_circ_negotiation_message(const extend_info_t *ei,
circ_params_request_set_cc_enabled(&params,
congestion_control_enabled());
*msg_len_out = circ_params_request_encoded_len(&params);
msg_len = circ_params_request_encoded_len(&params);
if (*msg_len_out < 0) {
if (msg_len < 0) {
return -1;
}
*msg_out = tor_malloc_zero(*msg_len_out);
*msg_out = tor_malloc_zero(msg_len);
*msg_len_out = circ_params_request_encode(*msg_out, *msg_len_out, &params);
msg_len = circ_params_request_encode(*msg_out, msg_len, &params);
if (*msg_len_out < 0) {
if (msg_len < 0) {
tor_free(*msg_out);
return -1;
}
*msg_len_out = (size_t)msg_len;
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