diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-19 13:05:16 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-03-26 08:44:04 +1000 |
commit | 3c4c8dd84ac18345a44120bb28f7fc85e33da093 (patch) | |
tree | b4e92c245c9d1df3677da7e94352d801fb608ac2 /crypto/encode_decode | |
parent | 26d5244253f94b6bd0fa41d4a222c827d8c5b3fe (diff) |
encoder: fix coverity 1473235: null dereference
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14618)
Diffstat (limited to 'crypto/encode_decode')
-rw-r--r-- | crypto/encode_decode/encoder_pkey.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/encode_decode/encoder_pkey.c b/crypto/encode_decode/encoder_pkey.c index fc5a391420..713aa44131 100644 --- a/crypto/encode_decode/encoder_pkey.c +++ b/crypto/encode_decode/encoder_pkey.c @@ -261,7 +261,7 @@ static int ossl_encoder_ctx_setup_for_pkey(OSSL_ENCODER_CTX *ctx, } } - if (OSSL_ENCODER_CTX_get_num_encoders(ctx) != 0) { + if (data != NULL && OSSL_ENCODER_CTX_get_num_encoders(ctx) != 0) { if (!OSSL_ENCODER_CTX_set_construct(ctx, encoder_construct_pkey) || !OSSL_ENCODER_CTX_set_construct_data(ctx, data) || !OSSL_ENCODER_CTX_set_cleanup(ctx, encoder_destruct_pkey)) |