From ea40176bee6c0312b97e2030248033d1681db4e2 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 12 May 2023 09:52:01 -0700 Subject: [PATCH] check for socket errors on SendAlert --- src/internal.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index 26a3b4fbe..1af47563f 100644 --- a/src/internal.c +++ b/src/internal.c @@ -33327,7 +33327,14 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, if (ret != 0 || !ssl->options.dtlsStateful) { int alertType = TranslateErrorToAlert(ret); if (alertType != invalid_alert) - SendAlert(ssl, alert_fatal, alertType); + if (alertType != invalid_alert) { + int err; + + /* propogate socket errors to avoid re-calling send alert */ + err = SendAlert(ssl, alert_fatal, alertType); + if (err == SOCKET_ERROR_E) + ret = SOCKET_ERROR_E; + } *inOutIdx += helloSz; DtlsResetState(ssl); if (DtlsIgnoreError(ret))