[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Don't forget to use the mutex in testing_enable_prefilled_rng()



commit 49acbfad23df415977fb7a196c6aae2d7406b489
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Mon May 6 17:21:11 2019 +0300

    Don't forget to use the mutex in testing_enable_prefilled_rng()
---
 src/test/rng_test_helpers.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/test/rng_test_helpers.c b/src/test/rng_test_helpers.c
index 262d380bd..d268cb64b 100644
--- a/src/test/rng_test_helpers.c
+++ b/src/test/rng_test_helpers.c
@@ -185,10 +185,14 @@ testing_enable_prefilled_rng(const void *buffer, size_t buflen)
   tor_assert(buflen > 0);
   rng_mutex = tor_mutex_new();
 
+  tor_mutex_acquire(rng_mutex);
+
   prefilled_rng_buffer = tor_memdup(buffer, buflen);
   prefilled_rng_buflen = buflen;
   prefilled_rng_idx = 0;
 
+  tor_mutex_release(rng_mutex);
+
   MOCK(crypto_rand, crypto_rand_prefilled);
   MOCK(crypto_strongest_rand_, mock_crypto_strongest_rand);
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits