apps/pkcs7.c:199: error: NULL_DEREFERENCE
  pointer `infile` last assigned on line 146 could be null and is dereferenced by call to `bio_open_default()` at line 199, column 10.
Showing all 48 steps of the trace


apps/pkcs7.c:141:1: start of procedure pkcs7_main()
139.   };
140.   
141. > int pkcs7_main(int argc, char **argv)
142.   {
143.       PKCS7 *p7 = NULL;

apps/pkcs7.c:143:5: 
141.   int pkcs7_main(int argc, char **argv)
142.   {
143. >     PKCS7 *p7 = NULL;
144.       BIO *in = NULL, *out = NULL;
145.       int informat = FORMAT_PEM, outformat = FORMAT_PEM;

apps/pkcs7.c:144:5: 
142.   {
143.       PKCS7 *p7 = NULL;
144. >     BIO *in = NULL, *out = NULL;
145.       int informat = FORMAT_PEM, outformat = FORMAT_PEM;
146.       char *infile = NULL, *outfile = NULL, *prog;

apps/pkcs7.c:145:5: 
143.       PKCS7 *p7 = NULL;
144.       BIO *in = NULL, *out = NULL;
145. >     int informat = FORMAT_PEM, outformat = FORMAT_PEM;
146.       char *infile = NULL, *outfile = NULL, *prog;
147.       int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;

apps/pkcs7.c:146:5: 
144.       BIO *in = NULL, *out = NULL;
145.       int informat = FORMAT_PEM, outformat = FORMAT_PEM;
146. >     char *infile = NULL, *outfile = NULL, *prog;
147.       int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;
148.       OPTION_CHOICE o;

apps/pkcs7.c:147:5: 
145.       int informat = FORMAT_PEM, outformat = FORMAT_PEM;
146.       char *infile = NULL, *outfile = NULL, *prog;
147. >     int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;
148.       OPTION_CHOICE o;
149.   

apps/pkcs7.c:150:5: Skipping opt_init(): empty list of specs
148.       OPTION_CHOICE o;
149.   
150.       prog = opt_init(argc, argv, pkcs7_options);
           ^
151.       while ((o = opt_next()) != OPT_EOF) {
152.           switch (o) {

apps/pkcs7.c:151:12: Loop condition is false. Leaving loop
149.   
150.       prog = opt_init(argc, argv, pkcs7_options);
151.       while ((o = opt_next()) != OPT_EOF) {
                  ^
152.           switch (o) {
153.           case OPT_EOF:

apps/pkcs7.c:193:5: 
191.           }
192.       }
193. >     argc = opt_num_rest();
194.       argv = opt_rest();
195.   

apps/opt.c:721:1: start of procedure opt_num_rest()
  719.   
  720.   /* How many items in remaining args? */
  721. > int opt_num_rest(void)
  722.   {
  723.       int i = 0;

apps/opt.c:723:5: 
  721.   int opt_num_rest(void)
  722.   {
  723. >     int i = 0;
  724.       char **pp;
  725.   

apps/opt.c:726:10: 
  724.       char **pp;
  725.   
  726. >     for (pp = opt_rest(); *pp; pp++, i++)
  727.           continue;
  728.       return i;

apps/opt.c:715:1: start of procedure opt_rest()
    713.   
    714.   /* Return the rest of the arguments after parsing flags. */
    715. > char **opt_rest(void)
    716.   {
    717.       return &argv[opt_index];

apps/opt.c:717:5: 
    715.   char **opt_rest(void)
    716.   {
    717. >     return &argv[opt_index];
    718.   }
    719.   

apps/opt.c:718:1: return from a call to opt_rest
    716.   {
    717.       return &argv[opt_index];
    718. > }
    719.   
    720.   /* How many items in remaining args? */

apps/opt.c:726:27: Loop condition is false. Leaving loop
  724.       char **pp;
  725.   
  726.       for (pp = opt_rest(); *pp; pp++, i++)
                                   ^
  727.           continue;
  728.       return i;

apps/opt.c:728:5: 
  726.       for (pp = opt_rest(); *pp; pp++, i++)
  727.           continue;
  728. >     return i;
  729.   }
  730.   

apps/opt.c:729:1: return from a call to opt_num_rest
  727.           continue;
  728.       return i;
  729. > }
  730.   
  731.   /* Return a string describing the parameter type. */

apps/pkcs7.c:194:5: 
192.       }
193.       argc = opt_num_rest();
194. >     argv = opt_rest();
195.   
196.       if (!app_load_modules(NULL))

apps/opt.c:715:1: start of procedure opt_rest()
  713.   
  714.   /* Return the rest of the arguments after parsing flags. */
  715. > char **opt_rest(void)
  716.   {
  717.       return &argv[opt_index];

apps/opt.c:717:5: 
  715.   char **opt_rest(void)
  716.   {
  717. >     return &argv[opt_index];
  718.   }
  719.   

apps/opt.c:718:1: return from a call to opt_rest
  716.   {
  717.       return &argv[opt_index];
  718. > }
  719.   
  720.   /* How many items in remaining args? */

apps/pkcs7.c:196:10: 
194.       argv = opt_rest();
195.   
196. >     if (!app_load_modules(NULL))
197.           goto end;
198.   

apps/apps.c:539:1: start of procedure app_load_modules()
  537.   }
  538.   
  539. > int app_load_modules(const CONF *config)
  540.   {
  541.       CONF *to_free = NULL;

apps/apps.c:541:5: 
  539.   int app_load_modules(const CONF *config)
  540.   {
  541. >     CONF *to_free = NULL;
  542.   
  543.       if (config == NULL)

apps/apps.c:543:9: Taking true branch
  541.       CONF *to_free = NULL;
  542.   
  543.       if (config == NULL)
                 ^
  544.   	config = to_free = app_load_config_quiet(default_config_file);
  545.       if (config == NULL)

apps/apps.c:544:2: Skipping app_load_config_quiet(): empty list of specs
  542.   
  543.       if (config == NULL)
  544.   	config = to_free = app_load_config_quiet(default_config_file);
          ^
  545.       if (config == NULL)
  546.   	return 1;

apps/apps.c:545:9: Taking true branch
  543.       if (config == NULL)
  544.   	config = to_free = app_load_config_quiet(default_config_file);
  545.       if (config == NULL)
                 ^
  546.   	return 1;
  547.   

apps/apps.c:546:2: 
  544.   	config = to_free = app_load_config_quiet(default_config_file);
  545.       if (config == NULL)
  546. > 	return 1;
  547.   
  548.       if (CONF_modules_load(config, NULL, 0) <= 0) {

apps/apps.c:556:1: return from a call to app_load_modules
  554.       NCONF_free(to_free);
  555.       return 1;
  556. > }
  557.   
  558.   int add_oid_section(CONF *conf)

apps/pkcs7.c:196:10: Taking false branch
194.       argv = opt_rest();
195.   
196.       if (!app_load_modules(NULL))
                ^
197.           goto end;
198.   

apps/pkcs7.c:199:35: Condition is true
197.           goto end;
198.   
199.       in = bio_open_default(infile, RB(informat));
                                         ^
200.       if (in == NULL)
201.           goto end;

apps/pkcs7.c:199:5: 
197.           goto end;
198.   
199. >     in = bio_open_default(infile, RB(informat));
200.       if (in == NULL)
201.           goto end;

apps/openssl.c:387:1: start of procedure bio_open_default()
  385.   }
  386.   
  387. > BIO *bio_open_default(const char *filename, const char *mode)
  388.   {
  389.       return bio_open_default_(filename, mode, 0);

apps/openssl.c:389:5: 
  387.   BIO *bio_open_default(const char *filename, const char *mode)
  388.   {
  389. >     return bio_open_default_(filename, mode, 0);
  390.   }
  391.   

apps/openssl.c:355:1: start of procedure bio_open_default_()
    353.   }
    354.   
    355. > static BIO *bio_open_default_(const char *filename, const char *mode, int quiet)
    356.   {
    357.       BIO *ret;

apps/openssl.c:359:9: Taking false branch
    357.       BIO *ret;
    358.   
    359.       if (filename == NULL || strcmp(filename, "-") == 0) {
                   ^
    360.           ret = *mode == 'r' ? dup_bio_in() : dup_bio_out();
    361.           if (quiet) {

apps/openssl.c:359:29: Taking true branch
    357.       BIO *ret;
    358.   
    359.       if (filename == NULL || strcmp(filename, "-") == 0) {
                                       ^
    360.           ret = *mode == 'r' ? dup_bio_in() : dup_bio_out();
    361.           if (quiet) {

apps/openssl.c:360:15: Condition is true
    358.   
    359.       if (filename == NULL || strcmp(filename, "-") == 0) {
    360.           ret = *mode == 'r' ? dup_bio_in() : dup_bio_out();
                         ^
    361.           if (quiet) {
    362.               ERR_clear_error();

apps/openssl.c:283:1: start of procedure dup_bio_in()
      281.   }
      282.   
      283. > BIO *dup_bio_in(void)
      284.   {
      285.       return BIO_new_fp(stdin, BIO_NOCLOSE | BIO_FP_TEXT);

apps/openssl.c:285:5: Skipping BIO_new_fp(): empty list of specs
      283.   BIO *dup_bio_in(void)
      284.   {
      285.       return BIO_new_fp(stdin, BIO_NOCLOSE | BIO_FP_TEXT);
                 ^
      286.   }
      287.   

apps/openssl.c:286:1: return from a call to dup_bio_in
      284.   {
      285.       return BIO_new_fp(stdin, BIO_NOCLOSE | BIO_FP_TEXT);
      286. > }
      287.   
      288.   BIO *dup_bio_out(void)

apps/openssl.c:360:9: 
    358.   
    359.       if (filename == NULL || strcmp(filename, "-") == 0) {
    360. >         ret = *mode == 'r' ? dup_bio_in() : dup_bio_out();
    361.           if (quiet) {
    362.               ERR_clear_error();

apps/openssl.c:361:13: Taking false branch
    359.       if (filename == NULL || strcmp(filename, "-") == 0) {
    360.           ret = *mode == 'r' ? dup_bio_in() : dup_bio_out();
    361.           if (quiet) {
                       ^
    362.               ERR_clear_error();
    363.               return ret;

apps/openssl.c:365:13: Taking true branch
    363.               return ret;
    364.           }
    365.           if (ret != NULL)
                       ^
    366.               return ret;
    367.           BIO_printf(bio_err,

apps/openssl.c:366:13: 
    364.           }
    365.           if (ret != NULL)
    366. >             return ret;
    367.           BIO_printf(bio_err,
    368.                      "Can't open %s, %s\n",

apps/openssl.c:385:1: return from a call to bio_open_default_
    383.       ERR_print_errors(bio_err);
    384.       return NULL;
    385. > }
    386.   
    387.   BIO *bio_open_default(const char *filename, const char *mode)

apps/openssl.c:390:1: return from a call to bio_open_default
  388.   {
  389.       return bio_open_default_(filename, mode, 0);
  390. > }
  391.   
  392.   BIO *bio_open_default_quiet(const char *filename, const char *mode)
