[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Richard Levitte levitte at openssl.org
Wed Oct 19 10:17:51 UTC 2016


The branch OpenSSL_1_0_2-stable has been updated
       via  1c6aab6a527b057133b470fa8c778e3d45f1605a (commit)
      from  99c002b305705a3d1e092402bc092de1943fbc27 (commit)


- Log -----------------------------------------------------------------
commit 1c6aab6a527b057133b470fa8c778e3d45f1605a
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Oct 6 09:31:34 2016 +0200

    Make 'openssl prime ""' not segfault
    
    Fixes RT#4699
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1668)

-----------------------------------------------------------------------

Summary of changes:
 apps/prime.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/apps/prime.c b/apps/prime.c
index 1fb1c8d..133167f 100644
--- a/apps/prime.c
+++ b/apps/prime.c
@@ -128,16 +128,24 @@ int MAIN(int argc, char **argv)
         BIO_printf(bio_out, "%s\n", s);
         OPENSSL_free(s);
     } else {
+        int r;
+
         if (hex)
-            BN_hex2bn(&bn, argv[0]);
+            r = BN_hex2bn(&bn, argv[0]);
         else
-            BN_dec2bn(&bn, argv[0]);
+            r = BN_dec2bn(&bn, argv[0]);
+
+        if(!r) {
+            BIO_printf(bio_err, "Failed to process value (%s)\n", argv[0]);
+            goto end;
+        }
 
         BN_print(bio_out, bn);
         BIO_printf(bio_out, " is %sprime\n",
                    BN_is_prime_ex(bn, checks, NULL, NULL) ? "" : "not ");
     }
 
+ end:
     BN_free(bn);
     BIO_free_all(bio_out);
 


More information about the openssl-commits mailing list