diff --git a/src/internal.c b/src/internal.c index cd25cfc40..2bf201c9b 100644 --- a/src/internal.c +++ b/src/internal.c @@ -25063,6 +25063,19 @@ static int SendAlert_ex(WOLFSSL* ssl, int severity, int type) } #endif + /* + * We check if we are trying to send a + * CLOSE_NOTIFY alert + * */ + if (type == 0) { + if (!ssl->options.sentNotify) { + ssl->options.sentNotify = 1; + } else { + /* CLOSE_NOTIFY already sent */ + return 0; + } + } + ssl->buffers.outputBuffer.length += sendSz; ret = SendBuffered(ssl);