apps/crl2p7.c:155: error: NULL_DEREFERENCE
  pointer `infile` last assigned on line 103 could be null and is dereferenced by call to `bio_open_default()` at line 155, column 14.
Showing all 53 steps of the trace


apps/crl2p7.c:94:1: start of procedure crl2pkcs7_main()
92.   };
93.   
94. > int crl2pkcs7_main(int argc, char **argv)
95.   {
96.       BIO *in = NULL, *out = NULL;

apps/crl2p7.c:96:5: 
94.   int crl2pkcs7_main(int argc, char **argv)
95.   {
96. >     BIO *in = NULL, *out = NULL;
97.       PKCS7 *p7 = NULL;
98.       PKCS7_SIGNED *p7s = NULL;

apps/crl2p7.c:97:5: 
95.   {
96.       BIO *in = NULL, *out = NULL;
97. >     PKCS7 *p7 = NULL;
98.       PKCS7_SIGNED *p7s = NULL;
99.       STACK_OF(OPENSSL_STRING) *certflst = NULL;

apps/crl2p7.c:98:5: 
96.       BIO *in = NULL, *out = NULL;
97.       PKCS7 *p7 = NULL;
98. >     PKCS7_SIGNED *p7s = NULL;
99.       STACK_OF(OPENSSL_STRING) *certflst = NULL;
100.       STACK_OF(X509) *cert_stack = NULL;

apps/crl2p7.c:99:5: 
97.       PKCS7 *p7 = NULL;
98.       PKCS7_SIGNED *p7s = NULL;
99. >     STACK_OF(OPENSSL_STRING) *certflst = NULL;
100.       STACK_OF(X509) *cert_stack = NULL;
101.       STACK_OF(X509_CRL) *crl_stack = NULL;

apps/crl2p7.c:100:5: 
98.       PKCS7_SIGNED *p7s = NULL;
99.       STACK_OF(OPENSSL_STRING) *certflst = NULL;
100. >     STACK_OF(X509) *cert_stack = NULL;
101.       STACK_OF(X509_CRL) *crl_stack = NULL;
102.       X509_CRL *crl = NULL;

apps/crl2p7.c:101:5: 
99.       STACK_OF(OPENSSL_STRING) *certflst = NULL;
100.       STACK_OF(X509) *cert_stack = NULL;
101. >     STACK_OF(X509_CRL) *crl_stack = NULL;
102.       X509_CRL *crl = NULL;
103.       char *infile = NULL, *outfile = NULL, *prog, *certfile;

apps/crl2p7.c:102:5: 
100.       STACK_OF(X509) *cert_stack = NULL;
101.       STACK_OF(X509_CRL) *crl_stack = NULL;
102. >     X509_CRL *crl = NULL;
103.       char *infile = NULL, *outfile = NULL, *prog, *certfile;
104.       int i = 0, informat = FORMAT_PEM, outformat = FORMAT_PEM, ret = 1, nocrl =

apps/crl2p7.c:103:5: 
101.       STACK_OF(X509_CRL) *crl_stack = NULL;
102.       X509_CRL *crl = NULL;
103. >     char *infile = NULL, *outfile = NULL, *prog, *certfile;
104.       int i = 0, informat = FORMAT_PEM, outformat = FORMAT_PEM, ret = 1, nocrl =
105.           0;

apps/crl2p7.c:104:5: 
102.       X509_CRL *crl = NULL;
103.       char *infile = NULL, *outfile = NULL, *prog, *certfile;
104. >     int i = 0, informat = FORMAT_PEM, outformat = FORMAT_PEM, ret = 1, nocrl =
105.           0;
106.       OPTION_CHOICE o;

apps/crl2p7.c:108:5: Skipping opt_init(): empty list of specs
106.       OPTION_CHOICE o;
107.   
108.       prog = opt_init(argc, argv, crl2pkcs7_options);
           ^
109.       while ((o = opt_next()) != OPT_EOF) {
110.           switch (o) {

apps/crl2p7.c:109:12: Loop condition is false. Leaving loop
107.   
108.       prog = opt_init(argc, argv, crl2pkcs7_options);
109.       while ((o = opt_next()) != OPT_EOF) {
                  ^
110.           switch (o) {
111.           case OPT_EOF:

apps/crl2p7.c:148:5: 
146.           }
147.       }
148. >     argc = opt_num_rest();
149.       argv = opt_rest();
150.   

apps/opt.c:717:1: start of procedure opt_num_rest()
  715.   
  716.   /* How many items in remaining args? */
  717. > int opt_num_rest(void)
  718.   {
  719.       int i = 0;

apps/opt.c:719:5: 
  717.   int opt_num_rest(void)
  718.   {
  719. >     int i = 0;
  720.       char **pp;
  721.   

apps/opt.c:722:10: 
  720.       char **pp;
  721.   
  722. >     for (pp = opt_rest(); *pp; pp++, i++)
  723.           continue;
  724.       return i;

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

apps/opt.c:713:5: 
    711.   char **opt_rest(void)
    712.   {
    713. >     return &argv[opt_index];
    714.   }
    715.   

apps/opt.c:714:1: return from a call to opt_rest
    712.   {
    713.       return &argv[opt_index];
    714. > }
    715.   
    716.   /* How many items in remaining args? */

apps/opt.c:722:27: Loop condition is false. Leaving loop
  720.       char **pp;
  721.   
  722.       for (pp = opt_rest(); *pp; pp++, i++)
                                   ^
  723.           continue;
  724.       return i;

apps/opt.c:724:5: 
  722.       for (pp = opt_rest(); *pp; pp++, i++)
  723.           continue;
  724. >     return i;
  725.   }
  726.   

apps/opt.c:725:1: return from a call to opt_num_rest
  723.           continue;
  724.       return i;
  725. > }
  726.   
  727.   /* Return a string describing the parameter type. */

apps/crl2p7.c:149:5: 
147.       }
148.       argc = opt_num_rest();
149. >     argv = opt_rest();
150.   
151.       if (!app_load_modules(NULL))

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

apps/opt.c:713:5: 
  711.   char **opt_rest(void)
  712.   {
  713. >     return &argv[opt_index];
  714.   }
  715.   

apps/opt.c:714:1: return from a call to opt_rest
  712.   {
  713.       return &argv[opt_index];
  714. > }
  715.   
  716.   /* How many items in remaining args? */

apps/crl2p7.c:151:10: 
149.       argv = opt_rest();
150.   
151. >     if (!app_load_modules(NULL))
152.           goto end;
153.   

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/crl2p7.c:151:10: Taking false branch
149.       argv = opt_rest();
150.   
151.       if (!app_load_modules(NULL))
                ^
152.           goto end;
153.   

apps/crl2p7.c:154:10: Taking true branch
152.           goto end;
153.   
154.       if (!nocrl) {
                ^
155.           in = bio_open_default(infile, RB(informat));
156.           if (in == NULL)

apps/crl2p7.c:155:39: Condition is false
153.   
154.       if (!nocrl) {
155.           in = bio_open_default(infile, RB(informat));
                                             ^
156.           if (in == NULL)
157.               goto end;

apps/crl2p7.c:155:9: 
153.   
154.       if (!nocrl) {
155. >         in = bio_open_default(infile, RB(informat));
156.           if (in == NULL)
157.               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)
