summaryrefslogtreecommitdiffstats
path: root/lib/libtls
diff options
context:
space:
mode:
authorbcook <bcook@openbsd.org>2019-05-13 22:36:01 +0000
committerbcook <bcook@openbsd.org>2019-05-13 22:36:01 +0000
commit565eed69f14342da70ab2a052c7a7f4885c42b03 (patch)
tree295dff3be102533e6febc104bf4288be400283dc /lib/libtls
parentAdd missing word in comment. (diff)
downloadwireguard-openbsd-565eed69f14342da70ab2a052c7a7f4885c42b03.tar.xz
wireguard-openbsd-565eed69f14342da70ab2a052c7a7f4885c42b03.zip
Acquire mutex before incrementing the refcount. Fixes COV-186144
ok tb@
Diffstat (limited to 'lib/libtls')
-rw-r--r--lib/libtls/tls_server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libtls/tls_server.c b/lib/libtls/tls_server.c
index 44bef6bb11d..a709a2bec92 100644
--- a/lib/libtls/tls_server.c
+++ b/lib/libtls/tls_server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_server.c,v 1.44 2018/03/19 16:34:47 jsing Exp $ */
+/* $OpenBSD: tls_server.c,v 1.45 2019/05/13 22:36:01 bcook Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -52,7 +52,9 @@ tls_server_conn(struct tls *ctx)
conn_ctx->flags |= TLS_SERVER_CONN;
+ pthread_mutex_lock(&ctx->config->mutex);
ctx->config->refcount++;
+ pthread_mutex_unlock(&ctx->config->mutex);
conn_ctx->config = ctx->config;
conn_ctx->keypair = ctx->config->keypair;