From 92e04fce9c7fc4622a73270719635d314b27e4fb Mon Sep 17 00:00:00 2001 From: svost Date: Fri, 12 Feb 2016 23:27:43 +0300 Subject: [PATCH] Fix V595 PVS Studio - the pointer was utilized before it was verified against nullptr. --- src/ecies.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ecies.cpp b/src/ecies.cpp index 215d390..fe2fb55 100644 --- a/src/ecies.cpp +++ b/src/ecies.cpp @@ -273,16 +273,16 @@ static int store_mac_tag(const ies_ctx_t *ctx, const unsigned char *envelope_key cryptogram_t * ecies_encrypt(const ies_ctx_t *ctx, const unsigned char *data, size_t length, char *error) { - const size_t block_length = EVP_CIPHER_block_size(ctx->cipher); - const size_t mac_length = EVP_MD_size(ctx->md); - cryptogram_t *cryptogram = NULL; - unsigned char *envelope_key = NULL; - if (!ctx || !data || !length) { SET_ERROR("Invalid arguments"); return NULL; } + const size_t block_length = EVP_CIPHER_block_size(ctx->cipher); + const size_t mac_length = EVP_MD_size(ctx->md); + cryptogram_t *cryptogram = NULL; + unsigned char *envelope_key = NULL; + if (block_length == 0 || block_length > EVP_MAX_BLOCK_LENGTH) { SET_ERROR("Derived block size is incorrect"); return NULL; -- 1.7.1