[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Matt Caswell matt at openssl.org
Thu Sep 22 08:05:31 UTC 2016


The branch OpenSSL_1_1_0-stable has been updated
       via  2178c52a8bacfd097a41f3f348fe51d8e4d1873e (commit)
      from  db610cb29cd2658c4feb60f4899856f0ac5e9dab (commit)


- Log -----------------------------------------------------------------
commit 2178c52a8bacfd097a41f3f348fe51d8e4d1873e
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Sep 21 14:44:42 2016 +0200

    test/x509aux.c: Fix argv loop
    
    There are cases when argc is more trustable than proper argv termination.
    Since we trust argc in all other test programs, we might as well treat it
    the same way in this program.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (cherry picked from commit 780bbb96bf514f0b4013e9c5725614ba5153c497)

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

Summary of changes:
 test/x509aux.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/test/x509aux.c b/test/x509aux.c
index 4f00196..2c20d6d 100644
--- a/test/x509aux.c
+++ b/test/x509aux.c
@@ -180,7 +180,6 @@ static int test_certs(BIO *fp)
 int main(int argc, char *argv[])
 {
     BIO *bio_err;
-    const char *certfile;
     const char *p;
     int ret = 1;
 
@@ -197,24 +196,30 @@ int main(int argc, char *argv[])
         CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
-    while ((certfile = *++argv) != NULL) {
-        BIO *f = BIO_new_file(certfile, "r");
+    argc--;
+    argv++;
+
+    while (argc >= 1) {
+        BIO *f = BIO_new_file(*argv, "r");
         int ok;
 
         if (f == NULL) {
             fprintf(stderr, "%s: Error opening cert file: '%s': %s\n",
-                    progname, certfile, strerror(errno));
+                    progname, *argv, strerror(errno));
             EXIT(ret);
         }
         ret = !(ok = test_certs(f));
         BIO_free(f);
 
         if (!ok) {
-            printf("%s ERROR\n", certfile);
+            printf("%s ERROR\n", *argv);
             ret = 1;
             break;
         }
-        printf("%s OK\n", certfile);
+        printf("%s OK\n", *argv);
+
+        argc--;
+        argv++;
     }
 
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG


More information about the openssl-commits mailing list