diff --git a/library/aes.c b/library/aes.c index f6dc9963e..1c743f95d 100644 --- a/library/aes.c +++ b/library/aes.c @@ -1298,6 +1298,9 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx, n = *iv_off; + if( n > 16 ) + return( MBEDTLS_ERR_AES_BAD_INPUT_DATA ); + if( mode == MBEDTLS_AES_DECRYPT ) { while( length-- ) @@ -1391,6 +1394,9 @@ int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx, n = *iv_off; + if( n > 16 ) + return( MBEDTLS_ERR_AES_BAD_INPUT_DATA ); + while( length-- ) { if( n == 0 )