pkey_gost_mac_keygen: check for NULL after allocating keydata
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 21:54:58 +0000 (22:54 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Thu, 4 Dec 2014 22:48:44 +0000 (23:48 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
engines/ccgost/gost_pmeth.c

index c8bf31c..7ccae86 100644 (file)
@@ -562,6 +562,8 @@ static int pkey_gost_mac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
                        return 0;
                }
                keydata = OPENSSL_malloc(32);
+               if (keydata == NULL)
+                       return 0;
                memcpy(keydata,data->key,32);
                EVP_PKEY_assign(pkey, NID_id_Gost28147_89_MAC, keydata);
                return 1;