Commit 78bcfc12 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

circpad_setup_machine_on_circ(): exit early on error.

This function does a nonfatal assertion to make sure that a machine
is not registered twice, but Tobias Pulls found a case where it
happens.  Instead, make the function exit early so that it doesn't
cause a remotely triggered memory leak.

Fixes bug 33619; bugfix on  This is also tracked as
parent 7a9e2a26
o Major bugfixes (circuit padding, memory leaks):
- Avoid a remotely triggered memory leak in the case that a circuit
padding machine is somehow negotiated twice on the same circuit. Fixes
bug 33619; bugfix on Found by Tobias Pulls. This is
also tracked as TROVE-2020-004.
......@@ -2381,9 +2381,12 @@ circpad_setup_machine_on_circ(circuit_t *on_circ,
== NULL);
tor_assert_nonfatal(on_circ->padding_info[machine->machine_index] == NULL);
IF_BUG_ONCE(on_circ->padding_machine[machine->machine_index] != NULL) {
IF_BUG_ONCE(on_circ->padding_info[machine->machine_index] != NULL) {
/* Log message */
if (CIRCUIT_IS_ORIGIN(on_circ)) {
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