diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-12-07 13:19:37 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-08 16:48:01 -0500 |
commit | 236e8b605e6aebf87787951ca05f5c75ad530c8a (patch) | |
tree | 37bee60e1abc25e4b11f0148540cb5382d3658de /src/or/onion.c | |
parent | d0b76f5099cb21c3f2d688d7e812f349dc06b695 (diff) | |
download | tor-236e8b605e6aebf87787951ca05f5c75ad530c8a.tar.gz tor-236e8b605e6aebf87787951ca05f5c75ad530c8a.zip |
Adding some assertions to onion.c
Diffstat (limited to 'src/or/onion.c')
-rw-r--r-- | src/or/onion.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/onion.c b/src/or/onion.c index 8e0896f360..42b9ca4b18 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -879,6 +879,7 @@ extend_cell_from_extend1_cell_body(extend_cell_t *cell_out, const extend1_cell_body_t *cell) { tor_assert(cell_out); + tor_assert(cell); memset(cell_out, 0, sizeof(*cell_out)); tor_addr_make_unspec(&cell_out->orport_ipv4.addr); tor_addr_make_unspec(&cell_out->orport_ipv6.addr); @@ -908,6 +909,7 @@ create_cell_from_create2_cell_body(create_cell_t *cell_out, const create2_cell_body_t *cell) { tor_assert(cell_out); + tor_assert(cell); memset(cell_out, 0, sizeof(create_cell_t)); if (BUG(cell->handshake_len > sizeof(cell_out->onionskin))) { /* This should be impossible because there just isn't enough room in the @@ -930,6 +932,7 @@ extend_cell_from_extend2_cell_body(extend_cell_t *cell_out, const extend2_cell_body_t *cell) { tor_assert(cell_out); + tor_assert(cell); int found_ipv4 = 0, found_ipv6 = 0, found_rsa_id = 0, found_ed_id = 0; memset(cell_out, 0, sizeof(*cell_out)); tor_addr_make_unspec(&cell_out->orport_ipv4.addr); @@ -988,6 +991,9 @@ extend_cell_parse(extend_cell_t *cell_out, const uint8_t command, const uint8_t *payload, size_t payload_length) { + tor_assert(cell_out); + tor_assert(payload); + if (payload_length > RELAY_PAYLOAD_SIZE) return -1; @@ -1033,6 +1039,7 @@ extend_cell_parse(extend_cell_t *cell_out, const uint8_t command, static int check_extended_cell(const extended_cell_t *cell) { + tor_assert(cell); if (cell->created_cell.cell_type == CELL_CREATED) { if (cell->cell_type != RELAY_COMMAND_EXTENDED) return -1; @@ -1054,6 +1061,9 @@ extended_cell_parse(extended_cell_t *cell_out, const uint8_t command, const uint8_t *payload, size_t payload_len) { + tor_assert(cell_out); + tor_assert(payload); + memset(cell_out, 0, sizeof(*cell_out)); if (payload_len > RELAY_PAYLOAD_SIZE) return -1; |