[tor-commits] [tor/master] Behave correctly when state->max_length is zero.

nickm at torproject.org nickm at torproject.org
Fri May 17 12:23:09 UTC 2019


commit a014e01b686cbe84bcfc9907d0a98ac71be91e3e
Author: George Kadianakis <desnacked at riseup.net>
Date:   Wed Mar 20 17:42:56 2019 +0200

    Behave correctly when state->max_length is zero.
---
 src/core/or/circuitpadding.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index ddf28ea62..61e222cbb 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -525,7 +525,10 @@ circpad_choose_state_length(circpad_machine_runtime_t *mi)
   length = circpad_distribution_sample(state->length_dist);
   length = MAX(0, length);
   length += state->start_length;
-  length = MIN(length, state->max_length);
+
+  if (state->max_length) {
+    length = MIN(length, state->max_length);
+  }
 
   mi->state_length = clamp_double_to_int64(length);
 }





More information about the tor-commits mailing list