From 9938dbeb01902dde5e803da0ab6e7d62442c6333 Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Fri, 26 Jul 2024 07:39:25 +0900 Subject: [PATCH] lock to update ctx crtOcspRequest --- src/tls.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tls.c b/src/tls.c index 30e5c476e9..2b651a81a9 100644 --- a/src/tls.c +++ b/src/tls.c @@ -3498,7 +3498,13 @@ static int TLSX_CSR_Parse(WOLFSSL* ssl, const byte* input, word16 length, der.buffer, der.length); if (ret == 0 && request == ssl->ctx->certOcspRequest) { - ssl->ctx->certOcspRequest = NULL; + wolfSSL_Mutex* ocspLock = + &SSL_CM(ssl)->ocsp_stapling->ocspLock; + if (wc_LockMutex(ocspLock) == 0) { + /* the request is ours */ + ssl->ctx->certOcspRequest = NULL; + } + wc_UnLockMutex(ocspLock); } } if (ret == 0) {