openssl srp: make index.txt parsing error more verbose
authorFlorian Mickler <florian@mickler.org>
Mon, 13 Jan 2020 01:06:49 +0000 (02:06 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 24 May 2021 12:37:00 +0000 (14:37 +0200)
If index.txt exists but has some problems (like for example
consisting of a single \n character or number of fields wrong in one of the lines)
then openssl will just exit. This fixes it by printing an error when
load_index returns null.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15360)

apps/srp.c

index 48b99da2af7f90e525eafbeff56df7e82354c2cb..a9466f830289b018af5267d0ea2de9b310730cd3 100644 (file)
@@ -379,8 +379,10 @@ int srp_main(int argc, char **argv)
                    srpvfile);
 
     db = load_index(srpvfile, NULL);
-    if (db == NULL)
+    if (db == NULL) {
+        BIO_printf(bio_err, "Problem with index file: %s (could not load/parse file)\n", srpvfile);
         goto end;
+    }
 
     /* Lets check some fields */
     for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {