]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Before freeing ewma objects, use memwipe instead of resetting magic.
authorNick Mathewson <nickm@torproject.org>
Thu, 13 Feb 2020 14:11:35 +0000 (09:11 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 13 Feb 2020 14:11:35 +0000 (09:11 -0500)
src/core/or/circuitmux_ewma.c

index 606b755e28ffa8df074e127e311947a8e82c0ff7..07f83af0f18f71b4ebe8fc80110fc5437d4e4744 100644 (file)
@@ -38,6 +38,7 @@
 #include "core/or/circuitmux.h"
 #include "core/or/circuitmux_ewma.h"
 #include "lib/crypt_ops/crypto_rand.h"
+#include "lib/crypt_ops/crypto_util.h"
 #include "feature/nodelist/networkstatus.h"
 #include "app/config/or_options_st.h"
 
@@ -299,7 +300,7 @@ ewma_free_cmux_data(circuitmux_t *cmux,
   pol = TO_EWMA_POL_DATA(pol_data);
 
   smartlist_free(pol->active_circuit_pqueue);
-  pol->base_.magic = 0xDEAD901C;
+  memwipe(pol, 0xda, sizeof(ewma_policy_data_t));
   tor_free(pol);
 }
 
@@ -366,7 +367,7 @@ ewma_free_circ_data(circuitmux_t *cmux,
   if (!pol_circ_data) return;
 
   cdata = TO_EWMA_POL_CIRC_DATA(pol_circ_data);
-  cdata->base_.magic = 0xDEADC14C;
+  memwipe(cdata, 0xdc, sizeof(ewma_policy_circ_data_t));
   tor_free(cdata);
 }