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

Andy Polyakov appro at openssl.org
Fri May 19 09:44:41 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  5a02eefaad7c8e53d6c7b9f57d947a9cfe6a167f (commit)
      from  c231202e10a078fc52cd51301553a1a09a957f8f (commit)


- Log -----------------------------------------------------------------
commit 5a02eefaad7c8e53d6c7b9f57d947a9cfe6a167f
Author: Diego Santa Cruz <Diego.SantaCruz at spinetix.com>
Date:   Wed May 17 10:17:59 2017 +0200

    Fix endless loop on srp app when listing users
    
    With the -list option the srp app loops on the main while() endlessly,
    whether users were given on the command line or not. The loop should
    be stopped when in list mode and there are no more users.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3489)
    
    (cherry picked from commit 5ec3210fc106ecc6badb48db6cfb1493a7607763)

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

Summary of changes:
 apps/srp.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/apps/srp.c b/apps/srp.c
index 253a3a3..726cc6e 100644
--- a/apps/srp.c
+++ b/apps/srp.c
@@ -37,13 +37,14 @@ static int get_index(CA_DB *db, char *id, char type)
     int i;
     if (id == NULL)
         return -1;
-    if (type == DB_SRP_INDEX)
+    if (type == DB_SRP_INDEX) {
         for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {
             pp = sk_OPENSSL_PSTRING_value(db->db->data, i);
             if (pp[DB_srptype][0] == DB_SRP_INDEX
                 && strcmp(id, pp[DB_srpid]) == 0)
                 return i;
-    } else
+        }
+    } else {
         for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {
             pp = sk_OPENSSL_PSTRING_value(db->db->data, i);
 
@@ -51,6 +52,7 @@ static int get_index(CA_DB *db, char *id, char type)
                 && strcmp(id, pp[DB_srpid]) == 0)
                 return i;
         }
+    }
 
     return -1;
 }
@@ -549,10 +551,11 @@ int srp_main(int argc, char **argv)
                 doupdatedb = 1;
             }
         }
-        if (--argc > 0)
+        if (--argc > 0) {
             user = *(argv++);
-        else {
-            user = NULL;
+        } else {
+            /* no more processing in any mode if no users left */
+            break;
         }
     }
 


More information about the openssl-commits mailing list