From 13478a94a80fbbab6c4eba582c70f677ea02680b Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 7 Jun 2021 23:28:14 +0700 Subject: [PATCH] sanity check on block size with block cipher type --- src/internal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/internal.c b/src/internal.c index fea5f5023..1bd033218 100644 --- a/src/internal.c +++ b/src/internal.c @@ -17850,6 +17850,12 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input, #ifndef WOLFSSL_AEAD_ONLY if (ssl->specs.cipher_type == block) { word32 blockSz = ssl->specs.block_size; + + if (blockSz == 0) { + WOLFSSL_MSG("Invalid block size with block cipher type"); + ERROR_OUT(BAD_STATE_E, exit_buildmsg); + } + if (ssl->options.tls1_1) { args->ivSz = blockSz; args->sz += args->ivSz;