]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Check for EVP_CIPHER_CTX_new failure (#836)
authorBrad King <brad.king@kitware.com>
Tue, 6 Dec 2016 16:35:14 +0000 (11:35 -0500)
committerJoerg Sonnenberger <joerg@bec.de>
Tue, 6 Dec 2016 16:35:14 +0000 (17:35 +0100)
If this OpenSSL function fails to allocate memory it returns NULL.

libarchive/archive_cryptor.c

index 2a51dfe1d86ad333ef5136d378082b037a25dbd5..ced52fd7062ad1271291081a0a7ff8f2134995b8 100644 (file)
@@ -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;