From: Pauli Date: Thu, 24 Jun 2021 23:28:26 +0000 (+1000) Subject: apps: properly initialise arguments to EVP_PKEY_get_bn_param() X-Git-Tag: openssl-3.0.0-beta2~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4af922c583ce152f7d8f35869ab92d5b37cbfd2;p=thirdparty%2Fopenssl.git apps: properly initialise arguments to EVP_PKEY_get_bn_param() This avoids use of uninitialised memory. Follow on to #15900 Reviewed-by: Shane Lontis Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/15908) --- diff --git a/apps/req.c b/apps/req.c index 9fbe4e250f4..d0c620438bc 100644 --- a/apps/req.c +++ b/apps/req.c @@ -994,7 +994,7 @@ int req_main(int argc, char **argv) } fprintf(stdout, "Modulus="); if (EVP_PKEY_is_a(tpubkey, "RSA")) { - BIGNUM *n; + BIGNUM *n = NULL; /* Every RSA key has an 'n' */ EVP_PKEY_get_bn_param(pkey, "n", &n); diff --git a/apps/x509.c b/apps/x509.c index 558351ba304..b68530fb225 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -950,7 +950,7 @@ int x509_main(int argc, char **argv) BN_print(out, n); BN_free(n); } else if (EVP_PKEY_is_a(pkey, "DSA")) { - BIGNUM *dsapub; + BIGNUM *dsapub = NULL; /* Every DSA key has a 'pub' */ EVP_PKEY_get_bn_param(pkey, "pub", &dsapub);