From 6d5fefde4a8d0565f3a58bc786e036226972e36b Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Thu, 5 Sep 2024 14:18:24 +0200 Subject: [PATCH] dtls 1.3: Check header length before copying --- src/internal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/internal.c b/src/internal.c index 747dc621a..1e770daa8 100644 --- a/src/internal.c +++ b/src/internal.c @@ -11255,6 +11255,11 @@ static int GetDtls13RecordHeader(WOLFSSL* ssl, word32* inOutIdx, if (ret != 0) return ret; + if (ssl->dtls13CurRlLength > sizeof(ssl->dtls13CurRL)) { + WOLFSSL_MSG("Record header too long"); + return SEQUENCE_ERROR; + } + if (readSize < ssl->dtls13CurRlLength + DTLS13_RN_MASK_SIZE) { /* when using DTLS over a medium that does not guarantee that a full * message is received in a single read, we may end up without the full