summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-12-18 13:04:05 +0000
committerflorian <florian@openbsd.org>2019-12-18 13:04:05 +0000
commita08d704f6e155e0a8e2aba9ab07ab73db4f20816 (patch)
tree557767597d73f73c6b963bcb076d6bd12eff66a8
parentUpdate to libunbound 1.9.6 (diff)
downloadwireguard-openbsd-a08d704f6e155e0a8e2aba9ab07ab73db4f20816.tar.xz
wireguard-openbsd-a08d704f6e155e0a8e2aba9ab07ab73db4f20816.zip
Workaround unbound github issue #99.
https://github.com/NLnetLabs/unbound/issues/99 ub_ctx_delete would free the passed in event_base leading to use-after-free since libunbound never allocated the memory and unwind expects to continue using the event_base.
-rw-r--r--sbin/unwind/resolver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index 36515c2b570..8a40fead8b6 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.117 2019/12/18 09:18:27 florian Exp $ */
+/* $OpenBSD: resolver.c,v 1.118 2019/12/18 13:04:05 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -1183,6 +1183,8 @@ create_resolver(enum uw_resolver_type type)
log_warnx("could not create unbound context");
return (NULL);
}
+ /* until github issue #99 is addressed*/
+ res->ctx->event_base_malloced = 0;
ub_ctx_debuglevel(res->ctx, log_getverbose() & OPT_VERBOSE3 ?
UB_LOG_VERBOSE : UB_LOG_BRIEF);
@@ -1327,6 +1329,9 @@ setup_unified_caches(void)
if ((ctx = ub_ctx_create_event(ev_base)) == NULL)
fatalx("could not create unbound context");
+ /* until github issue #99 is addressed*/
+ ctx->event_base_malloced = 0;
+
for (i = 0; i < nitems(options); i++) {
if ((err = ub_ctx_set_option(ctx, options[i].name,
options[i].value)) != 0) {