aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-03-14 14:44:33 -0400
committerNick Mathewson <nickm@torproject.org>2020-03-16 17:59:57 -0400
commit78bcfc1280b322ba57a10a116457616eeb742ab6 (patch)
tree59a317fbc9c2dacd95c1e300a475b6dfb9c1592f
parent7a9e2a261b44b93e244c04593dee8f7757ba32bc (diff)
downloadtor-78bcfc1280b322ba57a10a116457616eeb742ab6.tar.gz
tor-78bcfc1280b322ba57a10a116457616eeb742ab6.zip
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 0.4.0.1-alpha. This is also tracked as TROVE-2020-004.
-rw-r--r--changes/ticket336195
-rw-r--r--src/core/or/circuitpadding.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/changes/ticket33619 b/changes/ticket33619
new file mode 100644
index 0000000000..3c52858b35
--- /dev/null
+++ b/changes/ticket33619
@@ -0,0 +1,5 @@
+ 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 0.4.0.1-alpha. Found by Tobias Pulls. This is
+ also tracked as TROVE-2020-004.
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index a62cdcf9e6..72b770113c 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -2381,9 +2381,12 @@ circpad_setup_machine_on_circ(circuit_t *on_circ,
return;
}
- tor_assert_nonfatal(on_circ->padding_machine[machine->machine_index]
- == NULL);
- tor_assert_nonfatal(on_circ->padding_info[machine->machine_index] == NULL);
+ IF_BUG_ONCE(on_circ->padding_machine[machine->machine_index] != NULL) {
+ return;
+ }
+ IF_BUG_ONCE(on_circ->padding_info[machine->machine_index] != NULL) {
+ return;
+ }
/* Log message */
if (CIRCUIT_IS_ORIGIN(on_circ)) {