Skip to content

Commit a963c5f

Browse files
committed
add check to prevent integer underflow
1 parent a696d11 commit a963c5f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/internal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21240,7 +21240,8 @@ static int SanityCheckCipherText(WOLFSSL* ssl, word32 encryptSz)
2124021240
if (ssl->specs.cipher_type == block) {
2124121241
#ifdef HAVE_ENCRYPT_THEN_MAC
2124221242
if (ssl->options.startedETMRead) {
21243-
if ((encryptSz - MacSize(ssl)) % ssl->specs.block_size) {
21243+
if (encryptSz < minLength ||
21244+
(encryptSz - MacSize(ssl)) % ssl->specs.block_size) {
2124421245
WOLFSSL_MSG("Block ciphertext not block size");
2124521246
WOLFSSL_ERROR_VERBOSE(SANITY_CIPHER_E);
2124621247
return SANITY_CIPHER_E;

0 commit comments

Comments
 (0)