aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorulfvonbelow <strilen@tilde.club>2023-01-29 06:24:16 -0600
committerMartin Schanzenbach <schanzen@gnunet.org>2023-02-06 14:04:01 +0900
commitebdafecb3b388b5c629ce7855d253415be440edf (patch)
tree86a1f678be70cb42e762d7fba968a92782fa9898
parenteb1b1af264cfee84d2791bb68af9a8fd5d51b1f1 (diff)
downloadgnunet-ebdafecb3b388b5c629ce7855d253415be440edf.tar.gz
gnunet-ebdafecb3b388b5c629ce7855d253415be440edf.zip
NAMESTORE: avoid use-after-free in handle_record_result.
Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
-rw-r--r--src/namestore/namestore_api.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index df6ba1f33..2c5efb745 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -619,11 +619,17 @@ handle_record_result (void *cls, const struct RecordResultMessage *msg)
619 } 619 }
620 if (NULL != ze) 620 if (NULL != ze)
621 { 621 {
622 if (NULL != ze->proc) 622 // Store them here because a callback could free ze
623 ze->proc (ze->proc_cls, &private_key, name, rd_count, rd); 623 GNUNET_NAMESTORE_RecordMonitor proc;
624 if (NULL != ze->proc2) 624 GNUNET_NAMESTORE_RecordSetMonitor proc2;
625 ze->proc2 (ze->proc_cls, &private_key, name, 625 void *proc_cls = ze->proc_cls;
626 rd_count, rd, GNUNET_TIME_absolute_ntoh (msg->expire)); 626 proc = ze->proc;
627 proc2 = ze->proc2;
628 if (NULL != proc)
629 proc (proc_cls, &private_key, name, rd_count, rd);
630 if (NULL != proc2)
631 proc2 (proc_cls, &private_key, name,
632 rd_count, rd, GNUNET_TIME_absolute_ntoh (msg->expire));
627 return; 633 return;
628 } 634 }
629 } 635 }