diff options
author | bcook <bcook@openbsd.org> | 2019-05-13 22:36:01 +0000 |
---|---|---|
committer | bcook <bcook@openbsd.org> | 2019-05-13 22:36:01 +0000 |
commit | 565eed69f14342da70ab2a052c7a7f4885c42b03 (patch) | |
tree | 295dff3be102533e6febc104bf4288be400283dc /lib/libtls | |
parent | Add missing word in comment. (diff) | |
download | wireguard-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.c | 4 |
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; |