Check return value after loading config file
authorkinichiro <kinichiro.inoguchi@gmail.com>
Wed, 11 Dec 2019 12:12:53 +0000 (21:12 +0900)
committerPauli <paul.dale@oracle.com>
Fri, 13 Dec 2019 03:40:24 +0000 (13:40 +1000)
CLA: trivial

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10607)

(cherry picked from commit dd0139f416257ec5632414ed3ad8c61d07ba07ec)

apps/req.c
apps/ts.c

index f9d6fba1094da7177dcf375d80b9bc07ba390c42..d717c493e53ea6d2588933cf66a709c7f8eee405 100644 (file)
@@ -435,12 +435,14 @@ int req_main(int argc, char **argv)
 
     if (verbose)
         BIO_printf(bio_err, "Using configuration from %s\n", template);
-    req_conf = app_load_config(template);
+    if ((req_conf = app_load_config(template)) == NULL)
+        goto end;
     if (addext_bio) {
         if (verbose)
             BIO_printf(bio_err,
                        "Using additional configuration from command line\n");
-        addext_conf = app_load_config_bio(addext_bio, NULL);
+        if ((addext_conf = app_load_config_bio(addext_bio, NULL)) == NULL)
+            goto end;
     }
     if (template != default_config_file && !app_load_modules(req_conf))
         goto end;
index 930c1daaab6d4369a82ceb192acae2b9880c7e1d..44a8f75d4a370b94dcd06a8c43d3cfdeeee41fef 100644 (file)
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -282,7 +282,8 @@ int ts_main(int argc, char **argv)
         goto end;
     }
 
-    conf = load_config_file(configfile);
+    if ((conf = load_config_file(configfile)) == NULL)
+        goto end;
     if (configfile != default_config_file && !app_load_modules(conf))
         goto end;