From 75390937bc91de823c7af7f93098fea0ab73b4ad Mon Sep 17 00:00:00 2001 From: Marco Oliverio Date: Wed, 3 May 2023 12:20:52 +0000 Subject: [PATCH] tls13: correctly propagatae SendAlert err message --- src/tls13.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tls13.c b/src/tls13.c index bbe55396c..4c5bd9faf 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -10946,7 +10946,7 @@ static int SanityCheckTls13MsgReceived(WOLFSSL* ssl, byte type) int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, byte type, word32 size, word32 totalSz) { - int ret = 0; + int ret = 0, tmp; word32 inIdx = *inOutIdx; int alertType = invalid_alert; #if defined(HAVE_ECH) @@ -11186,7 +11186,11 @@ int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, if (type == client_hello && ssl->options.dtls) DtlsSetSeqNumForReply(ssl); #endif - SendAlert(ssl, alert_fatal, alertType); + tmp = SendAlert(ssl, alert_fatal, alertType); + /* propagate socket error instead of tls error to be sure the error is + * not ignored by DTLS code */ + if (tmp == SOCKET_ERROR_E) + ret = SOCKET_ERROR_E; } if (ret == 0 && ssl->options.tls1_3) {