Fix the allocation size in EVP_OpenInit and PEM_SignFinal
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8620)
(cherry picked from commit 8cf85d4899
)
This commit is contained in:
parent
b753435930
commit
8851d37287
2 changed files with 2 additions and 2 deletions
|
@ -40,7 +40,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
|||
}
|
||||
|
||||
size = EVP_PKEY_size(priv);
|
||||
key = OPENSSL_malloc(size + 2);
|
||||
key = OPENSSL_malloc(size);
|
||||
if (key == NULL) {
|
||||
/* ERROR */
|
||||
EVPerr(EVP_F_EVP_OPENINIT, ERR_R_MALLOC_FAILURE);
|
||||
|
|
|
@ -31,7 +31,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
|
|||
int i, ret = 0;
|
||||
unsigned int m_len;
|
||||
|
||||
m = OPENSSL_malloc(EVP_PKEY_size(pkey) + 2);
|
||||
m = OPENSSL_malloc(EVP_PKEY_size(pkey));
|
||||
if (m == NULL) {
|
||||
PEMerr(PEM_F_PEM_SIGNFINAL, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
|
|
Loading…
Reference in a new issue