summaryrefslogtreecommitdiff
path: root/sbin/unwind/resolver.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2019-12-18 13:04:06 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2019-12-18 13:04:06 +0000
commit8f4b5ca46fdab9f7dbd615786ee14f878f20091d (patch)
treeb6d173846f8a33d7e92df84a4c8b48ccbe5622a0 /sbin/unwind/resolver.c
parentfa11c1e89451345494a6d655fa7b48ab81b44036 (diff)
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.
Diffstat (limited to 'sbin/unwind/resolver.c')
-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) {