From 5e22d04bafe1dfd33ac132e5a81ae28e84799788 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 6 Mar 2026 17:05:35 +0100 Subject: [PATCH] Make sure size check doesn't underflow F-30 --- src/internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index df15b32f00..0b507ca6d8 100644 --- a/src/internal.c +++ b/src/internal.c @@ -22880,8 +22880,10 @@ static int DoProcessReplyEx(WOLFSSL* ssl, int allowSocketErr) #ifdef WOLFSSL_TLS13 if (IsAtLeastTLSv1_3(ssl->version)) { tooLong = ssl->curSize > MAX_TLS13_ENC_SZ; - tooLong |= ssl->curSize - ssl->specs.aead_mac_size > + if (ssl->specs.aead_mac_size < ssl->curSize) { + tooLong |= ssl->curSize - ssl->specs.aead_mac_size > MAX_TLS13_PLAIN_SZ; + } } #endif #ifdef WOLFSSL_EXTRA_ALERTS