diff --git a/src/internal.c b/src/internal.c index 8189e3eaa..5033744b7 100644 --- a/src/internal.c +++ b/src/internal.c @@ -21162,10 +21162,11 @@ default: ssl->keys.decryptedCur = 1; #ifdef WOLFSSL_TLS13 if (ssl->options.tls1_3) { - /* check that the end of the logical length doesn't extend - * past the real buffer */ + word16 i; word32 boundsCheck = (ssl->buffers.inputBuffer.idx + ssl->curSize - ssl->specs.aead_mac_size); + /* check that the end of the logical length doesn't extend + * past the real buffer */ if (boundsCheck > ssl->buffers.inputBuffer.length || boundsCheck == 0) { WOLFSSL_ERROR(BUFFER_ERROR); @@ -21173,7 +21174,7 @@ default: } /* end of plaintext */ - word16 i = (word16)(boundsCheck); + i = (word16)(boundsCheck); /* Remove padding from end of plain text. */ for (--i; i > ssl->buffers.inputBuffer.idx; i--) {