Skip to content

Commit 0c0c426

Browse files
committed
Fix from review
1 parent 415c288 commit 0c0c426

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/tls13.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,9 +2639,9 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
26392639

26402640
#ifdef WOLFSSL_CIPHER_TEXT_CHECK
26412641
if (ssl->specs.bulk_cipher_algorithm != wolfssl_cipher_null &&
2642-
dataSz >= WOLFSSL_CIPHER_CHECK_SZ) {
2642+
dataSz > 0) {
26432643
XMEMCPY(ssl->encrypt.sanityCheck, input,
2644-
sizeof(ssl->encrypt.sanityCheck));
2644+
min(dataSz, sizeof(ssl->encrypt.sanityCheck)));
26452645
}
26462646
#endif
26472647

@@ -2825,9 +2825,9 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
28252825

28262826
#ifdef WOLFSSL_CIPHER_TEXT_CHECK
28272827
if (ssl->specs.bulk_cipher_algorithm != wolfssl_cipher_null &&
2828-
dataSz >= WOLFSSL_CIPHER_CHECK_SZ &&
2828+
dataSz > 0 &&
28292829
XMEMCMP(output, ssl->encrypt.sanityCheck,
2830-
sizeof(ssl->encrypt.sanityCheck)) == 0) {
2830+
min(dataSz, sizeof(ssl->encrypt.sanityCheck))) == 0) {
28312831

28322832
WOLFSSL_MSG("EncryptTls13 sanity check failed! Glitch?");
28332833
return ENCRYPT_ERROR;

0 commit comments

Comments
 (0)