diff --git a/src/internal.c b/src/internal.c index f7f0b26d644..8edb69b0db4 100644 --- a/src/internal.c +++ b/src/internal.c @@ -22395,6 +22395,11 @@ static int removeMsgInnerPadding(WOLFSSL* ssl) /* Get the real content type from the end of the data. */ ssl->curRL.type = ssl->buffers.inputBuffer.buffer[i]; + if (ssl->curRL.type == 0) { + SendAlert(ssl, alert_fatal, unexpected_message); + WOLFSSL_ERROR(PARSE_ERROR); + return PARSE_ERROR; + } /* consider both contentType byte and MAC as padding */ ssl->keys.padSz = ssl->buffers.inputBuffer.idx + ssl->curSize - i;