From: Brad King Date: Tue, 6 Dec 2016 16:35:14 +0000 (-0500) Subject: Check for EVP_CIPHER_CTX_new failure (#836) X-Git-Tag: v3.3.0~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acd1d96d3e0df583ab661943bb1ffb93a8000dd5;p=thirdparty%2Flibarchive.git Check for EVP_CIPHER_CTX_new failure (#836) If this OpenSSL function fails to allocate memory it returns NULL. --- diff --git a/libarchive/archive_cryptor.c b/libarchive/archive_cryptor.c index 2a51dfe1d..ced52fd70 100644 --- a/libarchive/archive_cryptor.c +++ b/libarchive/archive_cryptor.c @@ -302,7 +302,8 @@ aes_ctr_release(archive_crypto_ctx *ctx) static int aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) { - ctx->ctx = EVP_CIPHER_CTX_new(); + if ((ctx->ctx = EVP_CIPHER_CTX_new()) == NULL) + return -1; switch (key_len) { case 16: ctx->type = EVP_aes_128_ecb(); break;