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) {