From 6107aebdf21a59834c3fe0eb6d3d664f1827c7bc Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Sun, 8 Oct 2017 08:58:01 -0500 Subject: [PATCH] Don't start multiple blacklist checks per ve This fixes a use-after-free I was seeing. --- .../gnunet-service-transport_validation.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 4a6d427be..5a8539f72 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -697,7 +697,6 @@ revalidate_address (void *cls) struct GNUNET_TIME_Relative canonical_delay; struct GNUNET_TIME_Relative delay; struct GNUNET_TIME_Relative blocked_for; - struct GST_BlacklistCheck *bc; uint32_t rdelay; ve->revalidation_task = NULL; @@ -784,15 +783,17 @@ revalidate_address (void *cls) GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# address revalidations started"), 1, GNUNET_NO); - bc = GST_blacklist_test_allowed (&ve->address->peer, - ve->address->transport_name, - &transmit_ping_if_allowed, - ve, - NULL, - NULL); - if (NULL != bc) - ve->bc = bc; /* only set 'bc' if 'transmit_ping_if_allowed' was not already - * called... */ + if (NULL != ve->bc) + { + GST_blacklist_test_cancel (ve->bc); + ve->bc = NULL; + } + ve->bc = GST_blacklist_test_allowed (&ve->address->peer, + ve->address->transport_name, + &transmit_ping_if_allowed, + ve, + NULL, + NULL); } -- 2.25.1