diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-04-28 17:04:05 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-05-02 08:36:42 +0200 |
commit | bffdd57854510fefa69fbd979c2eb7420200dab5 (patch) | |
tree | 351ba7f2a894468178c9e2b2604cfa470f0f3e06 | |
parent | 07982ebe99c74642402c8065bb2479fb8a6ac13d (diff) |
fix_dh_paramgen_type: Avoid crash with invalid paramgen type
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18202)
(cherry picked from commit 359dad5178285d5471f2a57a5aa99c1f588dffcb)
-rw-r--r-- | crypto/evp/ctrl_params_translate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c index 0aa1c23bee..7d2f501dfb 100644 --- a/crypto/evp/ctrl_params_translate.c +++ b/crypto/evp/ctrl_params_translate.c @@ -1072,7 +1072,11 @@ static int fix_dh_paramgen_type(enum state state, return 0; if (state == PRE_CTRL_STR_TO_PARAMS) { - ctx->p2 = (char *)ossl_dh_gen_type_id2name(atoi(ctx->p2)); + if ((ctx->p2 = (char *)ossl_dh_gen_type_id2name(atoi(ctx->p2))) + == NULL) { + ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE); + return 0; + } ctx->p1 = strlen(ctx->p2); } |