summaryrefslogtreecommitdiffstats
path: root/crypto/encode_decode
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-19 04:05:16 +0100
committerPauli <pauli@openssl.org>2021-03-25 23:44:04 +0100
commit3c4c8dd84ac18345a44120bb28f7fc85e33da093 (patch)
treeb4e92c245c9d1df3677da7e94352d801fb608ac2 /crypto/encode_decode
parentapps: fix coverity 1470781: explicit null dereference (diff)
downloadopenssl-3c4c8dd84ac18345a44120bb28f7fc85e33da093.tar.xz
openssl-3c4c8dd84ac18345a44120bb28f7fc85e33da093.zip
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.c2
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))