[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Mon Jan 23 14:35:04 UTC 2017


The branch master has been updated
       via  0db1fb3fc13c4b1a2b916efbb374f40579b1398f (commit)
      from  dff70a2b7368e759fae8e608375a0b9f28dce848 (commit)


- Log -----------------------------------------------------------------
commit 0db1fb3fc13c4b1a2b916efbb374f40579b1398f
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Wed Nov 16 22:46:25 2016 +0100

    Fix use before assignment
    
     it was getting the SerialNumber of a previous cert.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2272)

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

Summary of changes:
 apps/ca.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/apps/ca.c b/apps/ca.c
index b48788c..98ec726 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -987,12 +987,11 @@ end_of_options:
             BIO_printf(bio_err, "writing new certificates\n");
         for (i = 0; i < sk_X509_num(cert_sk); i++) {
             BIO *Cout = NULL;
-            ASN1_INTEGER *serialNumber = X509_get_serialNumber(x);
+            X509 *xi = sk_X509_value(cert_sk, i);
+            ASN1_INTEGER *serialNumber = X509_get_serialNumber(xi);
             int k;
             char *n;
 
-            x = sk_X509_value(cert_sk, i);
-
             j = ASN1_STRING_length(serialNumber);
             p = (const char *)ASN1_STRING_get0_data(serialNumber);
 
@@ -1033,8 +1032,8 @@ end_of_options:
                 perror(new_cert);
                 goto end;
             }
-            write_new_certificate(Cout, x, 0, notext);
-            write_new_certificate(Sout, x, output_der, notext);
+            write_new_certificate(Cout, xi, 0, notext);
+            write_new_certificate(Sout, xi, output_der, notext);
             BIO_free_all(Cout);
         }
 


More information about the openssl-commits mailing list