mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
stop a potential overflow (pointed out by ilja)
svn:r3681
This commit is contained in:
parent
043fd5666f
commit
8054f82992
@ -436,8 +436,10 @@ int connection_edge_send_command(connection_t *fromconn, circuit_t *circ,
|
|||||||
rh.stream_id = fromconn->stream_id; /* else it's 0 */
|
rh.stream_id = fromconn->stream_id; /* else it's 0 */
|
||||||
rh.length = payload_len;
|
rh.length = payload_len;
|
||||||
relay_header_pack(cell.payload, &rh);
|
relay_header_pack(cell.payload, &rh);
|
||||||
if (payload_len)
|
if (payload_len) {
|
||||||
|
tor_assert(payload_len <= RELAY_PAYLOAD_SIZE);
|
||||||
memcpy(cell.payload+RELAY_HEADER_SIZE, payload, payload_len);
|
memcpy(cell.payload+RELAY_HEADER_SIZE, payload, payload_len);
|
||||||
|
}
|
||||||
|
|
||||||
log_fn(LOG_DEBUG,"delivering %d cell %s.", relay_command,
|
log_fn(LOG_DEBUG,"delivering %d cell %s.", relay_command,
|
||||||
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
|
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
|
||||||
|
Loading…
Reference in New Issue
Block a user