diff options
| author | Tomas Mraz <tomas@openssl.org> | 2022-06-02 16:50:15 +0200 |
|---|---|---|
| committer | Tomas Mraz <tomas@openssl.org> | 2022-06-06 09:44:53 +0200 |
| commit | 4fa5ed5ce5c345eaeaec8b86eda265add467f941 (patch) | |
| tree | 413d888ff88a73c5a00412c85435e85bb3d847e0 /crypto/encode_decode | |
| parent | 697d0b5ba146c232f5b2aa87f4e847a5495c1735 (diff) | |
| download | openssl-new-4fa5ed5ce5c345eaeaec8b86eda265add467f941.tar.gz | |
Check return value of ossl_parse_property()
Also check if we have d2i_public_key() function pointer.
Fixes https://github.com/openssl/openssl/pull/18355#issuecomment-1144893289
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18462)
Diffstat (limited to 'crypto/encode_decode')
| -rw-r--r-- | crypto/encode_decode/decoder_meth.c | 7 | ||||
| -rw-r--r-- | crypto/encode_decode/encoder_meth.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/crypto/encode_decode/decoder_meth.c b/crypto/encode_decode/decoder_meth.c index a08705abb3..11e94dbcc4 100644 --- a/crypto/encode_decode/decoder_meth.c +++ b/crypto/encode_decode/decoder_meth.c @@ -191,8 +191,11 @@ void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef, return NULL; } decoder->base.algodef = algodef; - decoder->base.parsed_propdef - = ossl_parse_property(libctx, algodef->property_definition); + if ((decoder->base.parsed_propdef + = ossl_parse_property(libctx, algodef->property_definition)) == NULL) { + OSSL_DECODER_free(decoder); + return NULL; + } for (; fns->function_id != 0; fns++) { switch (fns->function_id) { diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c index 7571570d28..7a28894b2c 100644 --- a/crypto/encode_decode/encoder_meth.c +++ b/crypto/encode_decode/encoder_meth.c @@ -191,8 +191,11 @@ static void *encoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef, return NULL; } encoder->base.algodef = algodef; - encoder->base.parsed_propdef - = ossl_parse_property(libctx, algodef->property_definition); + if ((encoder->base.parsed_propdef + = ossl_parse_property(libctx, algodef->property_definition)) == NULL) { + OSSL_ENCODER_free(encoder); + return NULL; + } for (; fns->function_id != 0; fns++) { switch (fns->function_id) { |
