diff options
author | Richard Levitte <levitte@openssl.org> | 2003-12-01 13:11:55 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2003-12-01 13:11:55 +0100 |
commit | 1145e03870dd82eae00bb45e0b2162494b9b2f38 (patch) | |
tree | 908305861a133b3c760044f2e7e5da1a19873292 | |
parent | CRYPTO_malloc(), CRYPTO_realloc() and variants of them should return NULL (diff) | |
download | openssl-1145e03870dd82eae00bb45e0b2162494b9b2f38.tar.xz openssl-1145e03870dd82eae00bb45e0b2162494b9b2f38.zip |
Check that OPENSSL_malloc() really returned some memory.
PR: 751
Notified by: meder@mcs.anl.gov
Reviewed by: Lutz Jaenicke, Richard Levitte
Diffstat (limited to '')
-rw-r--r-- | crypto/evp/evp_enc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index db621bfc8b..658391105c 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -149,6 +149,11 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp ctx->cipher=cipher; ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); + if (!ctx->cipher_data) + { + EVPerr(EVP_F_EVP_CIPHERINIT, ERR_R_MALLOC_FAILURE); + return 0; + } ctx->key_len = cipher->key_len; ctx->flags = 0; if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT) |