apps/opt.c:454: error: NULL_DEREFERENCE
  pointer `xptmp` last assigned on line 453 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 454, column 13.
Showing all 31 steps of the trace


apps/opt.c:423:1: start of procedure opt_verify()
421.   enum range { OPT_V_ENUM };
422.   
423. > int opt_verify(int opt, X509_VERIFY_PARAM *vpm)
424.   {
425.       unsigned long ul;

apps/opt.c:431:5: Condition is true
429.       const X509_VERIFY_PARAM *vtmp;
430.   
431.       assert(vpm != NULL);
           ^
432.       assert(opt > OPT_V__FIRST);
433.       assert(opt < OPT_V__LAST);

apps/opt.c:432:5: Condition is true
430.   
431.       assert(vpm != NULL);
432.       assert(opt > OPT_V__FIRST);
           ^
433.       assert(opt < OPT_V__LAST);
434.   

apps/opt.c:433:5: Condition is true
431.       assert(vpm != NULL);
432.       assert(opt > OPT_V__FIRST);
433.       assert(opt < OPT_V__LAST);
           ^
434.   
435.       switch ((enum range)opt) {

apps/opt.c:435:5: 
433.       assert(opt < OPT_V__LAST);
434.   
435. >     switch ((enum range)opt) {
436.       case OPT_V__FIRST:
437.       case OPT_V__LAST:

apps/opt.c:436:5: Switch condition is false. Skipping switch case
434.   
435.       switch ((enum range)opt) {
436.       case OPT_V__FIRST:
           ^
437.       case OPT_V__LAST:
438.           return 0;

apps/opt.c:437:5: Switch condition is false. Skipping switch case
435.       switch ((enum range)opt) {
436.       case OPT_V__FIRST:
437.       case OPT_V__LAST:
           ^
438.           return 0;
439.       case OPT_V_POLICY:

apps/opt.c:439:5: Switch condition is false. Skipping switch case
437.       case OPT_V__LAST:
438.           return 0;
439.       case OPT_V_POLICY:
           ^
440.           otmp = OBJ_txt2obj(opt_arg(), 0);
441.           if (otmp == NULL) {

apps/opt.c:447:5: Switch condition is true. Entering switch case
445.           X509_VERIFY_PARAM_add0_policy(vpm, otmp);
446.           break;
447.       case OPT_V_PURPOSE:
           ^
448.           i = X509_PURPOSE_get_by_sname(opt_arg());
449.           if (i < 0) {

apps/opt.c:448:9: 
446.           break;
447.       case OPT_V_PURPOSE:
448. >         i = X509_PURPOSE_get_by_sname(opt_arg());
449.           if (i < 0) {
450.               BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());

apps/opt.c:693:1: start of procedure opt_arg()
  691.   
  692.   /* Return the most recent flag parameter. */
  693. > char *opt_arg(void)
  694.   {
  695.       return arg;

apps/opt.c:695:5: 
  693.   char *opt_arg(void)
  694.   {
  695. >     return arg;
  696.   }
  697.   

apps/opt.c:696:1: return from a call to opt_arg
  694.   {
  695.       return arg;
  696. > }
  697.   
  698.   /* Return the most recent flag. */

apps/opt.c:448:9: Skipping X509_PURPOSE_get_by_sname(): empty list of specs
446.           break;
447.       case OPT_V_PURPOSE:
448.           i = X509_PURPOSE_get_by_sname(opt_arg());
               ^
449.           if (i < 0) {
450.               BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());

apps/opt.c:449:13: Taking false branch
447.       case OPT_V_PURPOSE:
448.           i = X509_PURPOSE_get_by_sname(opt_arg());
449.           if (i < 0) {
                   ^
450.               BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
451.               return 0;

apps/opt.c:453:9: 
451.               return 0;
452.           }
453. >         xptmp = X509_PURPOSE_get0(i);
454.           i = X509_PURPOSE_get_id(xptmp);
455.           X509_VERIFY_PARAM_set_purpose(vpm, i);

crypto/x509v3/v3_purp.c:160:1: start of procedure X509_PURPOSE_get0()
  158.   }
  159.   
  160. > X509_PURPOSE *X509_PURPOSE_get0(int idx)
  161.   {
  162.       if (idx < 0)

crypto/x509v3/v3_purp.c:162:9: Taking false branch
  160.   X509_PURPOSE *X509_PURPOSE_get0(int idx)
  161.   {
  162.       if (idx < 0)
                 ^
  163.           return NULL;
  164.       if (idx < (int)X509_PURPOSE_COUNT)

crypto/x509v3/v3_purp.c:164:9: Taking false branch
  162.       if (idx < 0)
  163.           return NULL;
  164.       if (idx < (int)X509_PURPOSE_COUNT)
                 ^
  165.           return xstandard + idx;
  166.       return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:166:12: Condition is true
  164.       if (idx < (int)X509_PURPOSE_COUNT)
  165.           return xstandard + idx;
  166.       return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
                    ^
  167.   }
  168.   

crypto/x509v3/v3_purp.c:166:5: 
  164.       if (idx < (int)X509_PURPOSE_COUNT)
  165.           return xstandard + idx;
  166. >     return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  167.   }
  168.   

crypto/stack/stack.c:328:1: start of procedure sk_value()
    326.   }
    327.   
    328. > void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:330:10: Taking false branch
    328.   void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
                    ^
    331.           return NULL;
    332.       return st->data[i];

crypto/stack/stack.c:330:17: Taking false branch
    328.   void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
                           ^
    331.           return NULL;
    332.       return st->data[i];

crypto/stack/stack.c:330:28: Taking true branch
    328.   void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
                                      ^
    331.           return NULL;
    332.       return st->data[i];

crypto/stack/stack.c:331:9: 
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
    331. >         return NULL;
    332.       return st->data[i];
    333.   }

crypto/stack/stack.c:333:1: return from a call to sk_value
    331.           return NULL;
    332.       return st->data[i];
    333. > }
    334.   
    335.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509v3/v3_purp.c:167:1: return from a call to X509_PURPOSE_get0
  165.           return xstandard + idx;
  166.       return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  167. > }
  168.   
  169.   int X509_PURPOSE_get_by_sname(char *sname)

apps/opt.c:454:9: 
452.           }
453.           xptmp = X509_PURPOSE_get0(i);
454. >         i = X509_PURPOSE_get_id(xptmp);
455.           X509_VERIFY_PARAM_set_purpose(vpm, i);
456.           break;

crypto/x509v3/v3_purp.c:279:1: start of procedure X509_PURPOSE_get_id()
  277.   }
  278.   
  279. > int X509_PURPOSE_get_id(X509_PURPOSE *xp)
  280.   {
  281.       return xp->purpose;

crypto/x509v3/v3_purp.c:281:5: 
  279.   int X509_PURPOSE_get_id(X509_PURPOSE *xp)
  280.   {
  281. >     return xp->purpose;
  282.   }
  283.   
