]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix the allocation size in EVP_OpenInit and PEM_SignFinal
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 31 Mar 2019 10:00:16 +0000 (12:00 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 6 Apr 2019 08:17:19 +0000 (10:17 +0200)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8620)

crypto/evp/p_open.c
crypto/pem/pem_sign.c

index c9cd9b16c8e5591b6857e256f633018582c13920..a141eb4da5ffe35b1a98b62e54d7b2e80d0ed13e 100644 (file)
@@ -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);
index d8f6d07ae77ff46652f090f4a7af0b6b82ed8e67..4be03a479453ed9e951f2ef336e0971f07028754 100644 (file)
@@ -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;