apps/spkac.c:187: error: NULL_DEREFERENCE
  pointer `infile` last assigned on line 104 could be null and is dereferenced by call to `app_load_config()` at line 187, column 17.
Showing all 41 steps of the trace


apps/spkac.c:96:1: start of procedure spkac_main()
94.   };
95.   
96. > int spkac_main(int argc, char **argv)
97.   {
98.       BIO *out = NULL;

apps/spkac.c:98:5: 
96.   int spkac_main(int argc, char **argv)
97.   {
98. >     BIO *out = NULL;
99.       CONF *conf = NULL;
100.       ENGINE *e = NULL;

apps/spkac.c:99:5: 
97.   {
98.       BIO *out = NULL;
99. >     CONF *conf = NULL;
100.       ENGINE *e = NULL;
101.       EVP_PKEY *pkey = NULL;

apps/spkac.c:100:5: 
98.       BIO *out = NULL;
99.       CONF *conf = NULL;
100. >     ENGINE *e = NULL;
101.       EVP_PKEY *pkey = NULL;
102.       NETSCAPE_SPKI *spki = NULL;

apps/spkac.c:101:5: 
99.       CONF *conf = NULL;
100.       ENGINE *e = NULL;
101. >     EVP_PKEY *pkey = NULL;
102.       NETSCAPE_SPKI *spki = NULL;
103.       char *challenge = NULL, *keyfile = NULL;

apps/spkac.c:102:5: 
100.       ENGINE *e = NULL;
101.       EVP_PKEY *pkey = NULL;
102. >     NETSCAPE_SPKI *spki = NULL;
103.       char *challenge = NULL, *keyfile = NULL;
104.       char *infile = NULL, *outfile = NULL, *passinarg = NULL, *passin = NULL;

apps/spkac.c:103:5: 
101.       EVP_PKEY *pkey = NULL;
102.       NETSCAPE_SPKI *spki = NULL;
103. >     char *challenge = NULL, *keyfile = NULL;
104.       char *infile = NULL, *outfile = NULL, *passinarg = NULL, *passin = NULL;
105.       char *spkstr = NULL, *prog;

apps/spkac.c:104:5: 
102.       NETSCAPE_SPKI *spki = NULL;
103.       char *challenge = NULL, *keyfile = NULL;
104. >     char *infile = NULL, *outfile = NULL, *passinarg = NULL, *passin = NULL;
105.       char *spkstr = NULL, *prog;
106.       const char *spkac = "SPKAC", *spksect = "default";

apps/spkac.c:105:5: 
103.       char *challenge = NULL, *keyfile = NULL;
104.       char *infile = NULL, *outfile = NULL, *passinarg = NULL, *passin = NULL;
105. >     char *spkstr = NULL, *prog;
106.       const char *spkac = "SPKAC", *spksect = "default";
107.       int i, ret = 1, verify = 0, noout = 0, pubkey = 0;

apps/spkac.c:106:5: 
104.       char *infile = NULL, *outfile = NULL, *passinarg = NULL, *passin = NULL;
105.       char *spkstr = NULL, *prog;
106. >     const char *spkac = "SPKAC", *spksect = "default";
107.       int i, ret = 1, verify = 0, noout = 0, pubkey = 0;
108.       OPTION_CHOICE o;

apps/spkac.c:107:5: 
105.       char *spkstr = NULL, *prog;
106.       const char *spkac = "SPKAC", *spksect = "default";
107. >     int i, ret = 1, verify = 0, noout = 0, pubkey = 0;
108.       OPTION_CHOICE o;
109.   

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

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

apps/spkac.c:156:5: 
154.           }
155.       }
156. >     argc = opt_num_rest();
157.       argv = opt_rest();
158.   

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

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

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

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

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

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

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

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

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

apps/spkac.c:157:5: 
155.       }
156.       argc = opt_num_rest();
157. >     argv = opt_rest();
158.   
159.       if (!app_passwd(passinarg, NULL, &passin, NULL)) {

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

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

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

apps/spkac.c:159:10: 
157.       argv = opt_rest();
158.   
159. >     if (!app_passwd(passinarg, NULL, &passin, NULL)) {
160.           BIO_printf(bio_err, "Error getting password\n");
161.           goto end;

apps/apps.c:409:1: start of procedure app_passwd()
  407.   static char *app_get_pass(char *arg, int keepbio);
  408.   
  409. > int app_passwd(char *arg1, char *arg2, char **pass1, char **pass2)
  410.   {
  411.       int same;

apps/apps.c:412:10: Taking true branch
  410.   {
  411.       int same;
  412.       if (!arg2 || !arg1 || strcmp(arg1, arg2))
                  ^
  413.           same = 0;
  414.       else

apps/apps.c:413:9: 
  411.       int same;
  412.       if (!arg2 || !arg1 || strcmp(arg1, arg2))
  413. >         same = 0;
  414.       else
  415.           same = 1;

apps/apps.c:416:9: Taking false branch
  414.       else
  415.           same = 1;
  416.       if (arg1) {
                 ^
  417.           *pass1 = app_get_pass(arg1, same);
  418.           if (!*pass1)

apps/apps.c:420:16: Taking true branch
  418.           if (!*pass1)
  419.               return 0;
  420.       } else if (pass1)
                        ^
  421.           *pass1 = NULL;
  422.       if (arg2) {

apps/apps.c:421:9: 
  419.               return 0;
  420.       } else if (pass1)
  421. >         *pass1 = NULL;
  422.       if (arg2) {
  423.           *pass2 = app_get_pass(arg2, same ? 2 : 0);

apps/apps.c:422:9: Taking false branch
  420.       } else if (pass1)
  421.           *pass1 = NULL;
  422.       if (arg2) {
                 ^
  423.           *pass2 = app_get_pass(arg2, same ? 2 : 0);
  424.           if (!*pass2)

apps/apps.c:426:16: Taking false branch
  424.           if (!*pass2)
  425.               return 0;
  426.       } else if (pass2)
                        ^
  427.           *pass2 = NULL;
  428.       return 1;

apps/apps.c:428:5: 
  426.       } else if (pass2)
  427.           *pass2 = NULL;
  428. >     return 1;
  429.   }
  430.   

apps/apps.c:429:1: return from a call to app_passwd
  427.           *pass2 = NULL;
  428.       return 1;
  429. > }
  430.   
  431.   static char *app_get_pass(char *arg, int keepbio)

apps/spkac.c:159:10: Taking false branch
157.       argv = opt_rest();
158.   
159.       if (!app_passwd(passinarg, NULL, &passin, NULL)) {
                ^
160.           BIO_printf(bio_err, "Error getting password\n");
161.           goto end;

apps/spkac.c:164:9: Taking false branch
162.       }
163.   
164.       if (keyfile) {
               ^
165.           pkey = load_key(strcmp(keyfile, "-") ? keyfile : NULL,
166.                           FORMAT_PEM, 1, passin, e, "private key");

apps/spkac.c:187:9: 
185.       }
186.   
187. >     if ((conf = app_load_config(infile)) == NULL)
188.           goto end;
189.   
