Skip to content

Commit 9db2077

Browse files
authored
Merge pull request #7099 from jpbland1/tls13-bounds-check
TLS13 padding bounds check
2 parents bcfaf03 + b37716f commit 9db2077

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/internal.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21160,11 +21160,11 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr)
2116021160
ssl->keys.decryptedCur = 1;
2116121161
#ifdef WOLFSSL_TLS13
2116221162
if (ssl->options.tls1_3) {
21163-
/* end of plaintext */
21164-
word16 i = (word16)(ssl->buffers.inputBuffer.idx +
21165-
ssl->curSize - ssl->specs.aead_mac_size);
21166-
21167-
if (i > ssl->buffers.inputBuffer.length) {
21163+
word32 i = (ssl->buffers.inputBuffer.idx +
21164+
ssl->curSize - ssl->specs.aead_mac_size);
21165+
/* check that the end of the logical length doesn't extend
21166+
* past the real buffer */
21167+
if (i > ssl->buffers.inputBuffer.length || i == 0) {
2116821168
WOLFSSL_ERROR(BUFFER_ERROR);
2116921169
return BUFFER_ERROR;
2117021170
}

0 commit comments

Comments
 (0)