Explorar o código

Behave correctly when state->max_length is zero.

George Kadianakis %!s(int64=6) %!d(string=hai) anos
pai
achega
a014e01b68
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      src/core/or/circuitpadding.c

+ 4 - 1
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);
 }