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