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:39:31 +0000 (13:39 +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)

apps/req.c
apps/ts.c

index b084f108bdcea6769e71a798005b2473ff06c76f..76bbbeb555460dd510ed624901046dd9c5935fb1 100644 (file)
@@ -476,12 +476,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 196e97b9b074ca129e7a23d48eb678fd4904dcec..c651c8e5cd612706a6051015736d27888db13aef 100644 (file)
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -293,7 +293,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;