refactor and remove word16 index

This commit is contained in:
John Bland
2024-01-03 19:19:13 -05:00
parent 245c87fe8f
commit b37716f5ce

View File

@@ -21162,20 +21162,15 @@ default:
ssl->keys.decryptedCur = 1; ssl->keys.decryptedCur = 1;
#ifdef WOLFSSL_TLS13 #ifdef WOLFSSL_TLS13
if (ssl->options.tls1_3) { if (ssl->options.tls1_3) {
word16 i; word32 i = (ssl->buffers.inputBuffer.idx +
word32 boundsCheck = (ssl->buffers.inputBuffer.idx +
ssl->curSize - ssl->specs.aead_mac_size); ssl->curSize - ssl->specs.aead_mac_size);
/* check that the end of the logical length doesn't extend /* check that the end of the logical length doesn't extend
* past the real buffer */ * past the real buffer */
if (boundsCheck > ssl->buffers.inputBuffer.length || if (i > ssl->buffers.inputBuffer.length || i == 0) {
boundsCheck == 0) {
WOLFSSL_ERROR(BUFFER_ERROR); WOLFSSL_ERROR(BUFFER_ERROR);
return BUFFER_ERROR; return BUFFER_ERROR;
} }
/* end of plaintext */
i = (word16)(boundsCheck);
/* Remove padding from end of plain text. */ /* Remove padding from end of plain text. */
for (--i; i > ssl->buffers.inputBuffer.idx; i--) { for (--i; i > ssl->buffers.inputBuffer.idx; i--) {
if (ssl->buffers.inputBuffer.buffer[i] != 0) if (ssl->buffers.inputBuffer.buffer[i] != 0)