mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Fix an unused-variable warning
This commit is contained in:
parent
b286373908
commit
ef13bf4432
@ -771,12 +771,9 @@ extended_cell_parse(extended_cell_t *cell_out,
|
|||||||
const uint8_t command, const uint8_t *payload,
|
const uint8_t command, const uint8_t *payload,
|
||||||
size_t payload_len)
|
size_t payload_len)
|
||||||
{
|
{
|
||||||
const uint8_t *eop;
|
|
||||||
|
|
||||||
memset(cell_out, 0, sizeof(*cell_out));
|
memset(cell_out, 0, sizeof(*cell_out));
|
||||||
if (payload_len > RELAY_PAYLOAD_SIZE)
|
if (payload_len > RELAY_PAYLOAD_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
eop = payload + payload_len;
|
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case RELAY_COMMAND_EXTENDED:
|
case RELAY_COMMAND_EXTENDED:
|
||||||
@ -970,12 +967,11 @@ int
|
|||||||
extended_cell_format(uint8_t *command_out, uint16_t *len_out,
|
extended_cell_format(uint8_t *command_out, uint16_t *len_out,
|
||||||
uint8_t *payload_out, const extended_cell_t *cell_in)
|
uint8_t *payload_out, const extended_cell_t *cell_in)
|
||||||
{
|
{
|
||||||
uint8_t *p, *eop;
|
uint8_t *p;
|
||||||
if (check_extended_cell(cell_in) < 0)
|
if (check_extended_cell(cell_in) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
p = payload_out;
|
p = payload_out;
|
||||||
eop = payload_out + RELAY_PAYLOAD_SIZE;
|
|
||||||
memset(p, 0, RELAY_PAYLOAD_SIZE);
|
memset(p, 0, RELAY_PAYLOAD_SIZE);
|
||||||
|
|
||||||
switch (cell_in->cell_type) {
|
switch (cell_in->cell_type) {
|
||||||
@ -992,6 +988,8 @@ extended_cell_format(uint8_t *command_out, uint16_t *len_out,
|
|||||||
*command_out = RELAY_COMMAND_EXTENDED2;
|
*command_out = RELAY_COMMAND_EXTENDED2;
|
||||||
*len_out = 2 + cell_in->created_cell.handshake_len;
|
*len_out = 2 + cell_in->created_cell.handshake_len;
|
||||||
set_uint16(payload_out, htons(cell_in->created_cell.handshake_len));
|
set_uint16(payload_out, htons(cell_in->created_cell.handshake_len));
|
||||||
|
if (2+cell_in->created_cell.handshake_len > RELAY_PAYLOAD_SIZE)
|
||||||
|
return -1;
|
||||||
memcpy(payload_out+2, cell_in->created_cell.reply,
|
memcpy(payload_out+2, cell_in->created_cell.reply,
|
||||||
cell_in->created_cell.handshake_len);
|
cell_in->created_cell.handshake_len);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user