From b37716f5ce40f255d5e51cd63232521f8c144d54 Mon Sep 17 00:00:00 2001 From: John Bland Date: Wed, 3 Jan 2024 19:19:13 -0500 Subject: [PATCH] refactor and remove word16 index --- src/internal.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/internal.c b/src/internal.c index 5033744b7..112c34b00 100644 --- a/src/internal.c +++ b/src/internal.c @@ -21162,20 +21162,15 @@ default: ssl->keys.decryptedCur = 1; #ifdef WOLFSSL_TLS13 if (ssl->options.tls1_3) { - word16 i; - word32 boundsCheck = (ssl->buffers.inputBuffer.idx + + word32 i = (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) { + if (i > ssl->buffers.inputBuffer.length || i == 0) { WOLFSSL_ERROR(BUFFER_ERROR); return BUFFER_ERROR; } - /* end of plaintext */ - i = (word16)(boundsCheck); - /* Remove padding from end of plain text. */ for (--i; i > ssl->buffers.inputBuffer.idx; i--) { if (ssl->buffers.inputBuffer.buffer[i] != 0)