dev_crypto_md5_copy: return error if allocating to_md->data fails
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 17:11:34 +0000 (18:11 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 17 Aug 2014 16:52:30 +0000 (18:52 +0200)
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/evp/openbsd_hw.c

index 78ad707..b746c46 100644 (file)
@@ -427,6 +427,8 @@ static int dev_crypto_md5_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
     assert(from->digest->flags&EVP_MD_FLAG_ONESHOT);
 
     to_md->data=OPENSSL_malloc(from_md->len);
+    if (to_md->data == NULL)
+       return 0;
     memcpy(to_md->data,from_md->data,from_md->len);
 
     return 1;