[tor-commits] [tor/master] Set DH parameters to NULL on shutdown

nickm at torproject.org nickm at torproject.org
Thu Jan 11 18:00:44 UTC 2018


commit 06ffafcb9d4107297b6e72ee53d6e6db782cbdea
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Dec 11 11:37:54 2017 -0500

    Set DH parameters to NULL on shutdown
    
    If we don't do this, we will use freed memory on restart.
    
    Part of 24581.
---
 src/common/crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/common/crypto.c b/src/common/crypto.c
index 575bfd0c0..45aa3a02c 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -3470,6 +3470,8 @@ crypto_global_cleanup(void)
   if (dh_param_g)
     BN_clear_free(dh_param_g);
 
+  dh_param_p = dh_param_p_tls = dh_param_g = NULL;
+
 #ifndef DISABLE_ENGINES
   ENGINE_cleanup();
 #endif





More information about the tor-commits mailing list