diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-08-04 11:36:24 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-08-05 12:49:43 +0200 |
commit | 204323446e11d7062dc193e5e3986295925bd7b7 (patch) | |
tree | 677372a525101aa4d9d6d961159fda050ce4278b /apps/req.c | |
parent | 3d4ca443b4778e3230ff23f17625f58f815a9142 (diff) |
req: Avoid segfault when -modulus is used
Fixes #16196
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16215)
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/req.c b/apps/req.c index 5524092f2c..a0ecda8225 100644 --- a/apps/req.c +++ b/apps/req.c @@ -996,8 +996,8 @@ int req_main(int argc, char **argv) if (EVP_PKEY_is_a(tpubkey, "RSA")) { BIGNUM *n = NULL; - /* Every RSA key has an 'n' */ - EVP_PKEY_get_bn_param(pkey, "n", &n); + if (!EVP_PKEY_get_bn_param(tpubkey, "n", &n)) + goto end; BN_print(out, n); BN_free(n); } else { |