diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-05-10 20:49:50 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-05-10 22:53:39 +0100 |
commit | 9b5164ce7788d6985b005e410bb7b53bd553c99e (patch) | |
tree | c5950b1a7b65ae943b5fb56e5010b2391f97f4ee | |
parent | 1480b8a9ec3a75220da11dbbb336f3c03aa91053 (diff) | |
download | openssl-9b5164ce7788d6985b005e410bb7b53bd553c99e.tar.gz |
Add a couple of checks to prime app.
RT#4402
Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r-- | apps/prime.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/prime.c b/apps/prime.c index 3cbf98d4e6..072421e314 100644 --- a/apps/prime.c +++ b/apps/prime.c @@ -122,11 +122,19 @@ int prime_main(int argc, char **argv) goto end; } bn = BN_new(); + if (bn == NULL) { + BIO_printf(bio_err, "Out of memory.\n"); + goto end; + } if (!BN_generate_prime_ex(bn, bits, safe, NULL, NULL, NULL)) { BIO_printf(bio_err, "Failed to generate prime.\n"); goto end; } s = hex ? BN_bn2hex(bn) : BN_bn2dec(bn); + if (s == NULL) { + BIO_printf(bio_err, "Out of memory.\n"); + goto end; + } BIO_printf(bio_out, "%s\n", s); OPENSSL_free(s); } else { |